kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Sep 24, 2015 10:06 am Post subject: |
|
|
viswanathan,
It is quite simple with WHEN=GROUP. You just add a file ID number at the end of the record and validate that field to split into multiple files.
I assumed that your input is unsorted and you need to sort the file and then perform the split. If your input file is already sorted then simply replace the sort fields= statement with OPTION COPY.
Here is a DFSORT JCL which will give you the desired results.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your Input FB 750 Byte file
//KEY1 DD SYSOUT=*
//KEY2 DD SYSOUT=*
//KEY3 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,8,PD,A)
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,8),PUSH=(751:ID=1))
OUTFIL FNAMES=KEY1,BUILD=(1,750),INCLUDE=(751,1,ZD,EQ,1)
OUTFIL FNAMES=KEY2,BUILD=(1,750),INCLUDE=(751,1,ZD,EQ,2)
OUTFIL FNAMES=KEY3,BUILD=(1,750),SAVE
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|