Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT example to solve this issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Sat Nov 08, 2008 6:19 pm    Post subject: SORT example to solve this issue
Reply with quote

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
Back to top
View user's profile Send private message

expat

Global Moderator


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

PostPosted: Sat Nov 08, 2008 6:25 pm    Post subject:
Reply with quote

SUM FIELDS=( )
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Sat Nov 08, 2008 9:50 pm    Post subject:
Reply with quote

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))
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us