IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT example to solve this issue


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

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

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

DFSORT Developer


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

PostPosted: Sat Nov 08, 2008 9:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top