File Split using DFSORT
Moderators: Frank Yaeger, Moderator Group
File Split using DFSORT
Input File -> RECFM=FB,LRECL=6
Output Files also should be of Same RECFM,Same LRECL.
INPUT FILE SAMPLE DATA
HEADER
111111
333333
222222
444444
......
...... -> Like this there are N no of records. where N = even number
TRALER
I need to split the above input file into 2 O/P files using DFSORT.Both the output files should have the
header and trailer records as well.
Preferably not using the SUBSET function of DFSORT.
Thanks,
Veera.
Output Files also should be of Same RECFM,Same LRECL.
INPUT FILE SAMPLE DATA
HEADER
111111
333333
222222
444444
......
...... -> Like this there are N no of records. where N = even number
TRALER
I need to split the above input file into 2 O/P files using DFSORT.Both the output files should have the
header and trailer records as well.
Preferably not using the SUBSET function of DFSORT.
Thanks,
Veera.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Which records should go in which output file? Do you just want the first n/2 records in output file1 and the second n/2 records in output file2? Or do you want the first n/2 sorted records in file1 and the second n/2 sorted records in file2? Or do you want records 1, 3, 5, ... in file1 and 2, 4, 6, ... in file 2 (sorted? unsorted?).
Is there anything in the header and trailer records that identify them (e.g. '0' in position 1 for header record and '9' in position 1 for trailer record). If so, what identfies them.
Is there anything in the header and trailer records that identify them (e.g. '0' in position 1 for header record and '9' in position 1 for trailer record). If so, what identfies them.
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
Do you just want the first n/2 records in output file1 and the second n/2 records in output file2?
yes.
Is there anything in the header and trailer records that identify them (e.g. '0' in position 1 for header record and '9' in position 1 for trailer record). If so, what identfies them.
00 -> In Header starting from position 1.
99 -> Trailer starting from position 1.
00xxx -> Header rec's
99xxx -> Trailer rec's
One more new requirement for the same Job.
xxx -> represents the total count of records in the input file.
So after the file is split XXX -> should be updated accordingly as XXX/2
in both header and trailer.
say if the total records in the input file are 10(excluding the header and trailer record) then after the split, each file header and trailer records should have 5 in it as total count of records.
Thanks,
Veera.
yes.
Is there anything in the header and trailer records that identify them (e.g. '0' in position 1 for header record and '9' in position 1 for trailer record). If so, what identfies them.
00 -> In Header starting from position 1.
99 -> Trailer starting from position 1.
00xxx -> Header rec's
99xxx -> Trailer rec's
One more new requirement for the same Job.
xxx -> represents the total count of records in the input file.
So after the file is split XXX -> should be updated accordingly as XXX/2
in both header and trailer.
say if the total records in the input file are 10(excluding the header and trailer record) then after the split, each file header and trailer records should have 5 in it as total count of records.
Thanks,
Veera.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Assuming that '00' and '99' don't appear in positions 1-2 of the data records, you can use this DFSORT/ICETOOL job to do what you asked for:
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/6)
//OUT1 DD DSN=... output file1 (FB/6)
//OUT2 DD DSN=... output file2 (FB/6)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
OMIT COND=(1,2,SS,EQ,C'00,99')
INREC OVERLAY=(1:SEQNUM,3,ZD,
4:1,3,ZD,DIV,+2,EDIT=(TTT),80:X)
OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,
TRAILER1=(C' OMIT COND=(1,2,SS,EQ,C''00,99'')',/,
C' OUTFIL FNAMES=OUT1,ENDREC=',4,3,C',',/,
C' HEADER1=(''00',4,3,C'''),',/,
C' TRAILER1=(''99',4,3,C''')',/,
C' OUTFIL FNAMES=OUT2,SAVE,',/,
C' HEADER1=(''00',4,3,C'''),',/,
C' TRAILER1=(''99',4,3,C''')')
/*
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
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
Thanks a lot Frank, you are genius.
Theoretically it sounds simple, copy N/2 into first file and rest into second file. Building N was the crust and the tough part of the request. You always make it look so simple. It took a while and some paper work for me to understand it.
Thanks a ton.
Thanks,
Veera.
Theoretically it sounds simple, copy N/2 into first file and rest into second file. Building N was the crust and the tough part of the request. You always make it look so simple. It took a while and some paper work for me to understand it.
Thanks a ton.
Thanks,
Veera.
Split an input file into an O/P file depending on tags
Hi,
My input file is of the following format ( VBM,LRECL-32000)
X'D3A8C6'
---- resource
---- resource
---- resource
X'D3A9C6'
X'D3A8A8'
---- data
---- data
---- data
X'D3A9A8'
I need my O/P file( VBM,LRECL-32000) to contain only
X'D3A8A8'
---- data
---- data
---- data
X'D3A9A8'.
There are no specific tags or variables at specific positions to identify that the line is a data line or resource line but, resource and data lines are separated by diff tags as indicated above.
Please suggest a way to implement the same.
Thanks,
Subhadeep.
My input file is of the following format ( VBM,LRECL-32000)
X'D3A8C6'
---- resource
---- resource
---- resource
X'D3A9C6'
X'D3A8A8'
---- data
---- data
---- data
X'D3A9A8'
I need my O/P file( VBM,LRECL-32000) to contain only
X'D3A8A8'
---- data
---- data
---- data
X'D3A9A8'.
There are no specific tags or variables at specific positions to identify that the line is a data line or resource line but, resource and data lines are separated by diff tags as indicated above.
Please suggest a way to implement the same.
Thanks,
Subhadeep.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You need to do a better job of describing what you want to do.
What are the "rules" for which records go in the output file? Do you want the input records with specific "tags" and the data records which follow them or something else? How do you identify a "tag" vs a data record? Do the records actually have the characters X'...' or is that your way of showing a binary value?
Also, in the future please start a new Topic instead of putting a different question in an existing topic.
What are the "rules" for which records go in the output file? Do you want the input records with specific "tags" and the data records which follow them or something else? How do you identify a "tag" vs a data record? Do the records actually have the characters X'...' or is that your way of showing a binary value?
Also, in the future please start a new Topic instead of putting a different question in an existing topic.
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
Hi Frank,
Let me try and explain in more detail.
There are 2 blocks in the input file, one is a block of resource and another is a block of data, which are separated by the four tags as described above, a tag depicting the first 3 chars in the record... X'D3....' are hex values of the first record of the line. I hope this makes it clearer. Please let me know if I need to explain more.
Let me try and explain in more detail.
There are 2 blocks in the input file, one is a block of resource and another is a block of data, which are separated by the four tags as described above, a tag depicting the first 3 chars in the record... X'D3....' are hex values of the first record of the line. I hope this makes it clearer. Please let me know if I need to explain more.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
I'm still not sure I understand what you want to do. But since you say your file has RECFM=VBM, I'll assume your X'D3...' fields start in position 6 after the RDW and machine control character, and that you want the second group of records surrounded by X'D3A8' and X'D3A9' tags. If so, here's a DFSORT job that will do that.
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
IFTHEN=(WHEN=GROUP,BEGIN=(7,2,BI,EQ,X'D3A8'),
END=(7,2,BI,EQ,X'D3A9'),PUSH=(5:ID=1))
OUTFIL INCLUDE=(5,1,CH,EQ,C'2'),BUILD=(1,4,5:6)
/*
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