hello,
I have researched the forums and the manuals. i think i am trying to take Sort /SPLIT to far, but wanted to find out if this is possible.
I have a 100,000 rec file (volume always changes) that is sorted in keyed order by first 50 bytes, There is always multiple duplicate key records. I want to SPLIT the file into 4 some what equal output data sets with the duplicate keys on the same output date set, before writing to the next data set. Since the key values always change, i cant code them in sort. The number of duplicate records is variable also.
The idea would be each time key changes write to the next data set revolving thru the 4 files.
The SPLIT functions doesn't seem to be able to do variable splits based on key.
Any suggestions would be very welcomed.
Thank you in advance,
scramblermike
How to split file by multiple dup recs into multiple files.
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 2
- Joined: Fri Jan 27, 2012 2:01 am
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
If I understand correctly what you want to do, you can use a DFSORT job like the following. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I also assumed your records were already in sorted order by the key (if not, use SORT and OUTREC instead of COPY and INREC).
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//OUT1 DD DSN=... outpuf file1 (FB/80)
//OUT2 DD DSN=... outpuf file2 (FB/80)
//OUT3 DD DSN=... outpuf file3 (FB/80)
//OUT4 DD DSN=... outpuf file4 (FB/80)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,50),PUSH=(81:ID=8)),
IFTHEN=(WHEN=INIT,OVERLAY=(89:81,8,ZD,MOD,+4,TO=ZD,LENGTH=8))
OUTFIL FNAMES=OUT1,INCLUDE=(89,8,ZD,EQ,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(89,8,ZD,EQ,2),BUILD=(1,80)
OUTFIL FNAMES=OUT3,INCLUDE=(89,8,ZD,EQ,3),BUILD=(1,80)
OUTFIL FNAMES=OUT4,INCLUDE=(89,8,ZD,EQ,0),BUILD=(1,80)
/*
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
-
- Member
- Posts: 2
- Joined: Fri Jan 27, 2012 2:01 am
-
- Member
- Posts: 26
- Joined: Mon Jan 23, 2012 11:17 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can find details on DFSORT's KEYBEGIN function at:
http://www.ibm.com/support/docview.wss? ... g3T7000242
KEYBEGIN is also documented in "z/OS V1R12 DFSORT Application Programming Guide" at:
http://www.ibm.com/support/docview.wss? ... g3T7000242
http://www.ibm.com/support/docview.wss? ... g3T7000242
KEYBEGIN is also documented in "z/OS V1R12 DFSORT Application Programming Guide" at:
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