Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us