Author: magesh23586
Subject: Reply to: Get Record count in summary record for each group of records
Posted: Fri Sep 30, 2016 5:03 am (GMT 5.5)
Arun Raj,
Though you do it in ICETOOL, your solution is 4 Pass solution (1 for sort copy + 3 for Joinkeys) , which is not at all recommended when there is 1 step( Joinkey 3 Pass) solution is possible.
what will happen when second JOINKEYS Fails for some reason, we need to start sort copy + joinkey again, which means we are wasting resource unnecessarily.
Bill, Please correct me, if i am wrong.
The following code would be optimal + simple, where I am just sorting 12 bytes of records which will be much better than a reading a complete file with Sections. Below is the post I requested Bill to update.
Avoid Sorting, following code is still better than two step solution. where the combined record read is 116 bytes now.
_________________
Regards,
Magesh
Subject: Reply to: Get Record count in summary record for each group of records
Posted: Fri Sep 30, 2016 5:03 am (GMT 5.5)
Arun Raj,
Arun Raj wrote: |
Below is a "one step" ICETOOL version of the DFSORT solution posted earlier. |
Though you do it in ICETOOL, your solution is 4 Pass solution (1 for sort copy + 3 for Joinkeys) , which is not at all recommended when there is 1 step( Joinkey 3 Pass) solution is possible.
what will happen when second JOINKEYS Fails for some reason, we need to start sort copy + joinkey again, which means we are wasting resource unnecessarily.
Bill, Please correct me, if i am wrong.
The following code would be optimal + simple, where I am just sorting 12 bytes of records which will be much better than a reading a complete file with Sections. Below is the post I requested Bill to update.
Code: |
//SYSIN DD * OPTION COPY JOINKEYS FILE=F1,FIELDS=(1,6,A) JOINKEYS FILE=F2,FIELDS=(81,6,A),SORTED,NOSEQCK JOIN UNPAIRED,F2 REFORMAT FIELDS=(F2:1,80,F1:7,5) INREC IFOUTLEN=80, IFTHEN=(WHEN=(3,5,CH,EQ,C'COUNT'), OVERLAY=(3:81,5,ZD,SUB,+1,EDIT=(IIIIT),81:5X),HIT=NEXT), IFTHEN=(WHEN=ANY, FINDREP=(IN=C' ',OUT=C'',STARTPOS=3,ENDPOS=6)) //JNF1CNTL DD * INREC IFOUTLEN=12, IFTHEN=(WHEN=INIT, OVERLAY=(7:C'00001')), IFTHEN=(WHEN=GROUP, BEGIN=(1,1,CH,EQ,C'D'), PUSH=(1:ID=6)) SUM FIELDS=(7,5,ZD) //JNF2CNTL DD * INREC IFTHEN=(WHEN=GROUP, BEGIN=(1,1,CH,EQ,C'D'), PUSH=(81:ID=6)) |
Avoid Sorting, following code is still better than two step solution. where the combined record read is 116 bytes now.
Code: |
//SYSIN DD * OPTION COPY JOINKEYS FILE=F1,FIELDS=(6,7,A),SORTED,NOSEQCK JOINKEYS FILE=F2,FIELDS=(1,7,A),SORTED,NOSEQCK JOIN UNPAIRED,F2 REFORMAT FIELDS=(F2:1,98,?,F1:1,17) INREC IFTHEN=(WHEN=(99,1,CH,EQ,C'B'), OVERLAY=(21:100,5)), IFOUTLEN=98 OUTREC IFTHEN=(WHEN=INIT, FINDREP=(IN=C' ',OUT=C'',STARTPOS=21,ENDPOS=24)) OUTFIL SECTIONS=(13,6, TRAILER3=(19,80)),NODETAIL,REMOVECC,BUILD=(1,80) //JNF1CNTL DD * INREC IFOUTLEN=18, IFTHEN=(WHEN=INIT, OVERLAY=(12:C'A000001')), IFTHEN=(WHEN=GROUP, BEGIN=(1,1,CH,EQ,C'D'), PUSH=(1:SEQ=5,ID=6)), IFTHEN=(WHEN=INIT, OVERLAY=(1:1,5,ZD,SUB,+1,EDIT=(IIIIT))) //JNF2CNTL DD * OPTION COPY INREC IFTHEN=(WHEN=INIT, BUILD=(6X,C'B',11X,1,80)), IFTHEN=(WHEN=GROUP, BEGIN=(19,1,CH,EQ,C'D'), PUSH=(1:ID=6,13:SEQ=6)), IFTHEN=(WHEN=(19,1,CH,EQ,C'D'), OVERLAY=(7:C'A')) |
_________________
Regards,
Magesh