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

how to add the value of fields using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Fri Apr 11, 2008 9:05 pm
Reply with quote

hi,
for ex:
input:

Code:

200    04
200    05
201    04
202    10
202    03
202    02


i need an output like this:

Code:

200    09
201    04
202    15
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: Fri Apr 11, 2008 9:44 pm
Reply with quote

You can use these DFSORT control statements to do what you asked for:

Code:

    SORT FIELDS=(1,3,CH,A)
    OPTION ZDPRINT
    SUM FIELDS=(8,2,ZD)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 11, 2008 9:48 pm
Reply with quote

Sort on the first three bytes and sum on eight and ninth bytes.
Something like
Code:
 SORT FIELDS=(1,3,CH,A)
 SUM FIELDS=(8,2,ZD)


Dang Frank, you are quick....
Mean while, I'll be looking up the ZDPRINT option....grin.....
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Mon Apr 14, 2008 10:35 am
Reply with quote

Hi Frank and cics guy,

Thanks for your valuable suggestion, it works fine,

Thanks a lot..
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 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
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top