MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
somuk Beginner Joined: 04 Feb 2003 Posts: 113 Topics: 37
Posted: Wed Oct 27, 2004 2:59 pm Post subject: Sum on edited display field - Using sort
Hi
Can I use SYNCSORT for the following requirement?
Code:
Input File
---------
LRECL = 80, KEY FIELD is at POSITION 1 and LENGTH 2
----+----1----+----2
11 ABC 2,000.04
22 CDE 10.05
11 ABC 20.00
22 CDE 3,000.00
Code:
OutPut
-------
----+----1----+----2
11 ABC 2,000.04
11 ABC 20.00
11 ABC 2,020.04
22 CDE 10.05
22 CDE 3,000.00
22 CDE 3,010.05
_________________ Regds,
Somu
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Wed Oct 27, 2004 3:32 pm Post subject:
Somuk,
Try this Job. A brief explanation of the job. since the amount is numeric edited we need to convert it into zoned decimal to perform the sum.
So using INREC FIELDS we copy the 80 bytes as is and we put the amount field in 81st byte removing the comma and decimal point.
Using OUTREC FIELDS we convert the amount at 81st byte which is of floating sign format to zoned decimal for a length of 6.
Now using SECTIONS on OUTFIL we achieve the desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11 ABC 2,000.04
22 CDE 10.05
11 ABC 20.00
22 CDE 3,000.00
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(01,80,
08,1,
10,3,
14,2)
SORT FIELDS=(1,2,CH,A)
OUTREC FIELDS=(01,80,
81,6,FS,ZD,LENGTH=6)
OUTFIL OUTREC=(1,80),REMOVECC,
SECTIONS=(1,2,
TRAILER3=(1,7,TOT=(81,6,ZD,M2),80:X))
/*
The output from this job is :
Code:
11 ABC 2,000.04
11 ABC 20.00
11 ABC 2,020.04
22 CDE 10.05
22 CDE 3,000.00
22 CDE 3,010.05
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
somuk Beginner Joined: 04 Feb 2003 Posts: 113 Topics: 37
Posted: Wed Oct 27, 2004 5:35 pm Post subject:
Thank you very much Kolusu.
If my input dateset is FBA and the output needs to be FB ,do I need to change anything in this job? _________________ Regds,
Somu
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Oct 28, 2004 4:41 am Post subject:
somuk,
Just Code RECFM=FB on the SORTOUT dataset.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
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