I have an input ps which i want to sort and find the sum of records having
duplicate sort keys in the following format.
input ps
---------
ab 5
ab-5
ab 5
ab 5
ac 2
ac 2
output ps should be in this format
--------------------------------------
ab10
ac04
My jcl is
//STEP010 EXEC PGM=SORT
//SORTIN DD DSN=INPUT.TEST.SUMFILDI,DISP=SHR
//SORTOUT DD DSN=OUTPUT.TEST.SUMFILDO,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,CH,A)
SUM FIELDS=(3,2,ZD)
//*
after i submitted the jcl i got maxcc=0. but when i opened the output ps;it was in the following state:
output ps showing
------------------
ab20 <---------it should be ab10
ac04
Pls tell me the correct control card or correct data type(ZD/PD) with which numbers can be added with signs(+5-5+5+5=10 not 20).
Thank you so much for the quick reply.
1.Please tell me what are sections, removecc, nodetail.
2.why are we using TRAILER3, i dont need to put any trailer record.
3. what is FS.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
What I'm doing with SECTIONS, NODETAIL, REMOVECC and TRAILER3 is similar to what you were trying to do with SUM FIELDS=NONE in that it keeps only one record of duplicates (which it treats as a section trailer record). The FS format (floating sign) can handle your sddd values. You can't use FS format with SUM, but you can use it with TRAILER3 TOT.
You can look up all of the parameters I used under "OUTFIL Control Statements" in "z/OS DFSORT Application Programming Guide". Here's a link:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: