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: 8657
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 numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am CICS-MQ connection setup issue kaushikv CICS 3 Wed Mar 21, 2018 8:10 pm How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm

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