Hi Dibakar,
Thanks.. But my input and output have a decimal point. So need to know how do we SUM numbers with a decimal point and get the required output..?
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 29, 2004 11:28 am Post subject:
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use the new SFF (signed free form) format to do this more easily and efficiently in either of the following two ways:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Chandra 300.05
Chandra -50.15
Guru 500.00
Guru -100.15
Senthil 200.25
Senthil -100.35
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,7,
* Use SFF to convert sddd.dd to ZD. Total the ZD values
* for each key and display the total as sddd.dd.
TRAILER3=(1,7,12:TOT=(12,7,SFF,EDIT=(SIIT.TT),SIGNS=(,-))))
/*
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Chandra 300.05
Chandra -50.15
Guru 500.00
Guru -100.15
Senthil 200.25
Senthil -100.35
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Use SFF to convert sddd.dd to ZD.
INREC OVERLAY=(12:12,7,SFF,TO=ZD)
* Sort on the key.
SORT FIELDS=(1,7,CH,A)
* Sum the ZD values.
SUM FIELDS=(12,7,ZD)
* Display the ZD total as sddd.dd.
OUTREC OVERLAY=(12:12,7,ZD,EDIT=(SIIT.TT),SIGNS=(,-))
In both cases, SORTOUT will have:
Code:
Chandra 249.90
Guru 399.85
Senthil 99.90
For complete information on all of the new DFSORT and ICETOOL functions available with these DFSORT PTFs, see:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum