Code: |
col1 col2 001 10 001 10 001 10 001 10 Record 40000 .... 001 10 records 41032 -- Write to file D0001A since after 40000 records the col2 changes in the next row 001 11 Record 41033 001 11 001 11 .. 001 12 Record 56000 001 12 records 80000 .. 001 12 records 82312 - Write to file D0001B since after 40000 records the col2 changes in the next row 001 13 records 82313 Similarly, we have to break after 40000 records where the last record was written and when col2 changes Currently, we have coded using SEQNUM, but the column changes are not handled //SYSIN DD * OPTION COPY INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'001'),OVERLAY=(110:SEQNUM,8,ZD)) OUTFIL FNAMES=D0001A, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,LE,40000) OUTFIL FNAMES=D0001B, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,40000,AND, 110,8,ZD,LE,80000) OUTFIL FNAMES=D0001C, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,80000,AND, 110,8,ZD,LE,120000) OUTFIL FNAMES=D0001D, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,120000,AND, 110,8,ZD,LE,160000) OUTFIL FNAMES=D0001E, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,160000,AND, 110,8,ZD,LE,200000) OUTFIL FNAMES=D0001F, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,200000,AND, 110,8,ZD,LE,240000) OUTFIL FNAMES=D0001G, INCLUDE=(1,3,CH,EQ,C'001',AND,110,8,ZD,GT,240000,AND, 110,8,ZD,LE,280000) |
Code: |
//SYSIN DD * OPTION COPY INCLUDE COND=(1,3,CH,EQ,C'001') OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(6,2),PUSH=(110:ID=2)) OUTFIL FNAMES=D0001A,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,1) OUTFIL FNAMES=D0001B,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,2) OUTFIL FNAMES=D0001C,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,3) OUTFIL FNAMES=D0001D,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,4) OUTFIL FNAMES=D0001E,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,5) OUTFIL FNAMES=D0001F,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,6) OUTFIL FNAMES=D0001G,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,7) OUTFIL FNAMES=D0001H,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,8) /* |
Suchay wrote: |
Reason for spitting into 8 files: we provide these reports to users into spreadsheets, so we it would be cumbersome for them to look into the reports, so we break into 40,000 records and when the col2 changes after 40000 records we create separate files |
Code: |
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(6,2),PUSH=(110:ID=,SEQ=6)) |
Code: |
INCLUDE=(110,2,ZD,EQ,1,AND,112,6,ZD,LE,40000)) |
Suchay wrote: |
001 10 records 41032 -- Write to file D0001A since after 40000 records the col2 changes in the next row |
Code: |
10 - 200,000 records 11- 8,000 records 12- 15,000 records 13- 97,000 records 14 - 5000 records total number of records = 325,000 |
Code: |
D0001A - 00001 to 40,000 records of 10 D0001B - 40,001 to 80,000 records of 10 D0001C - 80,001 to 120,000 records of 10 D0001D - 120,001 to 160,000 records of 10 D0001E - 160,001 to 200,000 records of 10 D0001F - 8,000 of 11 + 15,000 of 12 + 0001 to 7,000 of 13 D0001G - 7,0001 to 47,000 records of 13 D0001H - 47,0001 to 87,000 records of 13 |
Code: |
10 - 20,000 records 11- 8,000 records 12- 15,000 records 13- 17,000 records 14 - 15,000 records 15 - 9500 records 16 - 23,000 records 17 -18,500 records. |
Code: |
D0001A - 00001 to 43,000 records of 10 ,11, 12 D0001B - 43,001 to 84,500 records of 13, 14, 15 D0001C - 84,501 to 126,000 records of 16, 17 |
Suchay wrote: |
Let us try to keep it simple with 3 files with above data and output should like below. is it possible
|
Code: |
//SYSIN DD * OPTION COPY INREC IFTHEN=(WHEN=GROUP,RECORDS=40000,PUSH=(110:ID=2,113:SEQ=6)), IFTHEN=(WHEN=GROUP,KEYBEGIN=(6,2),PUSH=(120:SEQ=6)), IFTHEN=(WHEN=GROUP, BEGIN=(113,6,ZD,EQ,40000,AND,120,6,ZD,GT,1), END=(120,6,ZD,EQ,1), PUSH=(128:110,2)), IFTHEN=(WHEN=(120,6,ZD,NE,1,AND,128,2,CH,GT,C' '), OVERLAY=(110:128,2)) OUTFIL FNAMES=D0001A,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,1) OUTFIL FNAMES=D0001B,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,2) OUTFIL FNAMES=D0001C,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,3) OUTFIL FNAMES=D0001D,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,4) OUTFIL FNAMES=D0001E,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,5) OUTFIL FNAMES=D0001F,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,6) OUTFIL FNAMES=D0001G,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,7) OUTFIL FNAMES=D0001H,BUILD=(1,109),INCLUDE=(110,2,ZD,EQ,8) /* |
kolusu wrote: | ||
|
Code: |
OUTFIL FNAMES=D0001H,BUILD=(1,109),INCLUDE=(110,2,ZD,GE,8) |
Magesh_J wrote: | ||
Also we may have as follows, so we may not miss any records.
Regards, Magesh |
Code: |
OUTFIL FNAMES=REMAIN,BUILD=(1,109),SAVE |
output generated using printer-friendly topic mod. All times are GMT - 5 Hours