We have 1 file with header and trailer records. We have to Split this file such that:
a) Both files will have same header as obtained from input file
b) Both files will have same trailer as obtained from input file except the count of records present in newly created files.
c) Data records will be splitted based on 3 characters represented as XXX in sample data given below(records having XXX = 008
needs to be in one file and rest in other file).
I am able to copy header,trailer and split data records but not able to update the count of records in trailer . Moreover I don't think I created an optimised Icetool.
File properties are FB,LRECL=40
Sample Data in file is :
14X'00'ABCDEFGHIJK20110207 (Header)
12345678912345XXXO
68663647346764XXXO
93619719469696XXXO
69696696696996XXXO
.
.
.
12340010585858XXXO
14X'FF'ABCDEFGHIJK0000047723 (Trailer)
* Here initial 14 characters in Header are Low values X'00'
* initial 14 characters in trailer are High values X'FF'
* XXX(alphanumeric) are the 3 characters based on which split will occur starting from 15th position.
* Last 10 digits in trailer represent count starting from 26th position.
Please can somebody help me out by providing solution to my problem. Thanks
Splitting of File using Icetool
Moderators: Frank Yaeger, Moderator Group
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
why don't you start by:
- showing us your control cards
- provide a more realistic input file
- provide a precise expected output
- tell us what is/how is the 'split' indicator determined? - we know where the comparision is to take place, just don't know with what.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
provide a more realistic input file:
This is the realistic file as mentioned in my original post containing:
a) Header: first 14 characs as Low value then next 11 characs are system name and at the end 10 numeric digits containing business date
b) Trailer: first 14 characs as Low value then next 11 characs are system name and at the end 10 numeric digits showing count of main data records in file.
c) Data records: First 14 numeric digits containing account branch info then next 3 characs(doc type) based on which files will be splitted into 2 output files then at the end 1 charac representing a constant
provide a precise expected output
Two files with exactly same format as of input file,
a) same header values in both files, as in input file
b) Same trailer values in both files except the count of main data records obtained in respective file after splitting.
c) Data records in one file for doc type = 008 and in other all other records
tell us what is/how is the 'split' indicator determined? - we know where the comparision is to take place, just don't know with what
May be I have confused you by my earlier post, by split I meant just that one output file will have data records based on doc type =008(alphanumeric data) and other file with data records with other doc type. So we can simply copy records in respective output files by using Include or Omit condition.
I used 15,3,CH,EQ,'008'. (its working)
Hope I have clarified your queries a bit to enable you finding solution to my problem
This is the realistic file as mentioned in my original post containing:
a) Header: first 14 characs as Low value then next 11 characs are system name and at the end 10 numeric digits containing business date
b) Trailer: first 14 characs as Low value then next 11 characs are system name and at the end 10 numeric digits showing count of main data records in file.
c) Data records: First 14 numeric digits containing account branch info then next 3 characs(doc type) based on which files will be splitted into 2 output files then at the end 1 charac representing a constant
provide a precise expected output
Two files with exactly same format as of input file,
a) same header values in both files, as in input file
b) Same trailer values in both files except the count of main data records obtained in respective file after splitting.
c) Data records in one file for doc type = 008 and in other all other records
tell us what is/how is the 'split' indicator determined? - we know where the comparision is to take place, just don't know with what
May be I have confused you by my earlier post, by split I meant just that one output file will have data records based on doc type =008(alphanumeric data) and other file with data records with other doc type. So we can simply copy records in respective output files by using Include or Omit condition.
I used 15,3,CH,EQ,'008'. (its working)
Hope I have clarified your queries a bit to enable you finding solution to my problem
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT job that will do what you asked for using DFSORT's new IFTRAIL function available with the Oct, 2010 PTF. I assumed X'FF's in positions1-5 were enough to identify the trailer.
For more information on the Oct, 2010 DFSORT PTF,see:
http://www.ibm.com/support/docview.wss? ... g3T7000242
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,
INCLUDE=(15,3,CH,EQ,C'008'),
IFTRAIL=(HD=YES,TRLID=(1,5,BI,EQ,X'FFFFFFFFFF'),
TRLUPD=(26:COUNT=(M11,LENGTH=10)))
OUTFIL FNAMES=OUT2,
INCLUDE=(15,3,CH,NE,C'008'),
IFTRAIL=(HD=YES,TRLID=(1,5,BI,EQ,X'FFFFFFFFFF'),
TRLUPD=(26:COUNT=(M11,LENGTH=10)))
/*
http://www.ibm.com/support/docview.wss? ... g3T7000242
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page