Author: Arun Raj
Subject: Re: Reply to: Get Record count in summary record for each group of records
Posted: Fri Sep 30, 2016 11:19 pm (GMT 5.5)
Regarding the solution-2 by magesh23586, we don't really need to complicate things by adding another identifier 'A'.
I would do something like this, if this has to be a "one step" DFSORT thing.
My personal preference is not to generate duplicate records and then having to roll up later. I would have to run a performance comparison between the 2 step DFSORT and the above one. I will post it here when I have it.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard
Subject: Re: Reply to: Get Record count in summary record for each group of records
Posted: Fri Sep 30, 2016 11:19 pm (GMT 5.5)
Regarding the solution-2 by magesh23586, we don't really need to complicate things by adding another identifier 'A'.
I would do something like this, if this has to be a "one step" DFSORT thing.
Code: |
//STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTJNF1 DD DSN= >> Input data set (FB/80) //SORTJNF2 DD DSN= >> Same Input data set (FB/80) //SORTOUT DD DSN= >> Output data set (FB/80) //* //SYSIN DD * JOINKEYS FILE=F1,FIELDS=(81,4,A,01,01,A),SORTED,NOSEQCK JOINKEYS FILE=F2,FIELDS=(01,4,A,10,01,A),SORTED,NOSEQCK JOIN UNPAIRED,F1 REFORMAT FIELDS=(F1:85,5,1,80,F2:5,5) SORT FIELDS=COPY INREC IFTHEN=(WHEN=(8,5,CH,EQ,C'COUNT'), OVERLAY=(8:86,5),HIT=NEXT), IFTHEN=(WHEN=ANY, FINDREP=(IN=C' ',OUT=C'',STARTPOS=08,ENDPOS=11)) OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,5,TRAILER3=(6,80)),BUILD=(80X) /* //JNF1CNTL DD * INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'), PUSH=(81:ID=4,SEQ=5)) /* //JNF2CNTL DD * INREC IFOUTLEN=10, IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'), PUSH=(01:ID=4,SEQ=5)), IFTHEN=(WHEN=INIT,OVERLAY=(5:5,5,ZD,SUB,+1,M10,LENGTH=5,C'D')) /* |
My personal preference is not to generate duplicate records and then having to roll up later. I would have to run a performance comparison between the 2 step DFSORT and the above one. I will post it here when I have it.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard