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
 

 

DFSORT to summing up the records for a particular field

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

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Fri Mar 16, 2007 2:08 pm    Post subject: DFSORT to summing up the records for a particular field
Reply with quote

hi,

I have a small query on my application
For each employee i need the amount to be added up.
The input file is in this format
emp no:(2),emp name(20),amount(7)
Can we do this using "Sum fileds" of DFSORT
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 16, 2007 2:13 pm    Post subject:
Reply with quote

I would think so, what is your doubt?
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Fri Mar 16, 2007 2:19 pm    Post subject:
Reply with quote

just want the format...how to do this grouping..taking this input file as an example..
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Mar 16, 2007 2:20 pm    Post subject:
Reply with quote

Here are the DFSORT control statements you wanted -

Code:
//SYSIN DD  *
    SORT FIELDS=(1,2,CH,A)   * assumed emp no is x(2)
    SUM FIELDS=(23,7,ZD)    * assumption amount is 9(7)
/*
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: Fri Mar 16, 2007 8:50 pm    Post subject:
Reply with quote

lekshmi_ci,

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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
lekshmi_ci

New User


Joined: 14 Mar 2007
Posts: 60
Location: Thiruvananthapuram

PostPosted: Mon Mar 19, 2007 1:09 pm    Post subject:
Reply with quote

I want the output to be
the emp no,emp name and the added amount for each employee
The below piece of code
SORT FIELDS=(1,2,ZD,A)
SUM FIELDS=(23,7,ZD)
only sorts.The sum is not accumulated.
Please revert back icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Mar 19, 2007 2:12 pm    Post subject:
Reply with quote

lekshmi_ci wrote:
I want the output to be
the emp no,emp name and the added amount for each employee
The below piece of code
SORT FIELDS=(1,2,ZD,A)
SUM FIELDS=(23,7,ZD)
only sorts.The sum is not accumulated.
Please explain how "SUM FIELDS=(23,7,ZD)" doesn't work?
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: Mon Mar 19, 2007 9:27 pm    Post subject:
Reply with quote

Those control statements will sum the ZD value in positions 23-29 for each group of records with the same ZD value in positions 1-2. If the sum is not accumulated, then you haven't described your input records correctly.

Perhaps you need 1,2,CH,A instead of 1,2,ZD,A if your first field is a character value rather than a number? Or it might be that your summed ZD values are overflowing? Or it might be something else. It would help if you showed an example of your input records and what you expect for output, and told us the actual format of each field.
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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