D Rishi
New User
Joined: 01 Mar 2010 Posts: 21 Location: India
|
|
|
|
Hi,
I have a file (RECFM=FBA,LRECL=160) which i need to split into 4 based on header.
please find the sample below..
REPORT - A
0000123account
0011123account
4560123account
REPORT - A
0978693account
4534342account
.
.
.
REPORT - B
0230123account
0011123account
4560123account
REPORT - B
0123123account
0978693account
4534342account
.
.
REPORT - C
0000123account
0014523account
0230123account
REPORT - C
0978693account
4534342account
.
.
REPORT - D
0000123account
4560123account
REPORT - D
0123123account
.
.
I have to separate Report A,B,C,D to different files using sort..
there are no matchhing fields under the headers..
plz suugest a method..
thanks in advance.. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
D Rishi,
Assuming that you have the split indicator (A,B,C,D) in pos 11 and 'REPORT' string starting in pos 2, the following DFSORT JCL will give you the desired results.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input RECFM=FBA,LRECL=160 file,DISP=SHR
//RPTA DD SYSOUT=*
//RPTB DD SYSOUT=*
//RPTC DD SYSOUT=*
//RPTD DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,6,CH,EQ,C'REPORT'),PUSH=(161:11,1))
OUTFIL FNAMES=RPTA,BUILD=(1,160),INCLUDE=(161,1,CH,EQ,C'A')
OUTFIL FNAMES=RPTB,BUILD=(1,160),INCLUDE=(161,1,CH,EQ,C'B')
OUTFIL FNAMES=RPTC,BUILD=(1,160),INCLUDE=(161,1,CH,EQ,C'C')
OUTFIL FNAMES=RPTD,BUILD=(1,160),INCLUDE=(161,1,CH,EQ,C'D')
//* |
|
|