Ram Balaji wrote on 10/15/2008 10:41:01 AM: > Hi all > > My requirement is, I have an input file with following details > > 1 10 > 2 21 > 3 15 > 4 02 > > My desired output is > > 1 10 > 2 31 --> 31(10+21) > 3 46 --> 46(10+21+15) > 4 48 --> 48(10+21+15+02) > > Can this be done with JCL > > Regards, > Ram Balaji.S. > (Dying Hard to explore MainFrames)
You can do this with DFSORT's SUBTOT function as follows. I imagine it will work with Syncsort too. //S1 EXEC PGM=ICEMAN //SYSOUT DD SYSOUT=* //SORTIN DD * 1 10 2 21 3 15 4 02 /* //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY OUTFIL REMOVECC,NODETAIL, SECTIONS=(1,1, TRAILER3=(1,2,SUBTOT=(3,2,ZD,TO=ZDF,LENGTH=2))) /* SORTOUT would have:, 1 10 2 31 3 46 4 48 Frank Yaeger - DFSORT Development Team (IBM) - [EMAIL PROTECTED] Specialties: FINDREP, WHEN=GROUP, DATASORT, ICETOOL, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html