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 add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts how to add the amount for duplicate r... SRUTHI DRAVIDAMANI COBOL Programming 6 Wed Feb 21, 2018 7:21 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 15 Fri Feb 09, 2018 10:38 pm
No new posts Why is SORT rearranging records that ... cschablow DFSORT/ICETOOL 4 Wed Jan 24, 2018 10:14 pm

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