Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Naraismha Reddy

New User

Joined: 23 Apr 2008
Posts: 39

Posted: Sat Nov 08, 2008 6:19 pm    Post subject: SORT example to solve this issue

Following is my requirement..
I have data as follows (there are about 5 million i/p recs)

 Code: acct no          amount  d/c-indicator 99999XXXX0000    100.50         c 99999XXXX0000    100.50         c 99999XXXX0001    200.20         c 99999XXXX0001    212.20         c 99999XXXX0002    300.10         c 99999XXXX0002    350.00         c 99999XXXX0003    100.10         c 99999XXXX0003    350.00         c 99999XXXX0003    000.50         c 99999XXXX0004    010.00         c 99999XXXX0004    337.50         c 99999XXXX0004    600.30         c

after Sort it should look like.(no,of O/P records.9)

 Code: 99999XXXX0000    201.00         c 99999XXXX0001    412.40         c 99999XXXX0002    650.10         c 99999XXXX0003    450.60         c 99999XXXX0004    947.80         c

Thanks
Narasimha

expat

Global Moderator

Joined: 14 Mar 2007
Posts: 8631
Location: Back in jolly old England

 Posted: Sat Nov 08, 2008 6:25 pm    Post subject: SUM FIELDS=( )
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Sat Nov 08, 2008 9:50 pm    Post subject:

Expat,

SUM FIELDS=(...) would not be the best choice here since the values have a decimal point.

Narasimha,

You can use a DFSORT job like the one below to do what you asked for. Since you showed your input records already in sorted order, I used a MERGE which is more efficient than a SORT.

 Code: //S1 EXEC PGM=ICEMAN //SYSOUT DD SYSOUT=* //SORTIN01 DD * 99999XXXX0000    100.50         c 99999XXXX0000    100.50         c 99999XXXX0001    200.20         c 99999XXXX0001    212.20         c 99999XXXX0002    300.10         c 99999XXXX0002    350.00         c 99999XXXX0003    100.10         c 99999XXXX0003    350.00         c 99999XXXX0003    000.50         c 99999XXXX0004    010.00         c 99999XXXX0004    337.50         c 99999XXXX0004    600.30         c /* //SORTOUT DD DSN=...  output file //SYSIN DD *   MERGE FIELDS=(1,13,CH,A)   OUTFIL REMOVECC,NODETAIL,     SECTIONS=(1,13,       TRAILER3=(1,13,         TOT=(14,10,UFF,EDIT=(IIIIIIT.TT)),         33:33,1)) /*
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am SIGNAL ON HALT issue packerm CLIST & REXX 1 Fri Oct 20, 2017 6:56 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us