First - do not post in JCL as JCL cannot do this but it will tell the OS that you want to run sort (which flavour of sort do you use? DF or SYNC or soemthing else?) to do what you want. You should post in the appropriate SORT section of the forum.
Suggest you use the manual for your sort product and the answer is probably along the lines of:
//S1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * XYZ USA 100.00 XYZ USA 100.00 XYZ USA 100.00 ABC ENG 100.00 ABC ENG 100.00 ABC ENG 100.00 //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY OUTFIL REMOVECC,NODETAIL, SECTIONS=(1,8, TRAILER3=(1,8,10:TOT=(10,8,UFF,EDIT=(IIIIT.TT)))) /*
Note: SUM with ZD will NOT work correctly for values with decimal points.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
The following is working for addition of positive amounts.
Input file
XYZ USA 0000000000100Û50 XYZ USA 0000000000100Û00 XYZ USA 0000000000100Û00 ABC ENG 0000000000100Û00 ABC ENG 0000000000100Û00 ABC ENG 0000000000100Û00
Output file ABC ENG 0000000000300Û00 XYZ USA 0000000000300Û50
//SYSIN DD * SORT FIELDS=(1,7,CH,A) SUM FIELDS=(10,13,ZD,24,2,ZD) /*
Now my question is how to add negative amounts
XYZ USA 0000000000100Û50 XYZ USA -000000000100Û00 XYZ USA 0000000000100Û00 ABC ENG 0000000000100Û00 ABC ENG 0000000000100Û00 ABC ENG 0000000000100Û00
-000000000100 is NOT a ZD value. It's an SFF value and you would use SECTIONS and TRAILER3 with TOTAL to sum these values similar to the first example I showed. The DFSORT control statements would be something like this:
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort