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

DFSORT to summing up the records for a particular field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Fri Mar 16, 2007 2:13 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Fri Mar 16, 2007 2:20 pm
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 Developer


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

PostPosted: Fri Mar 16, 2007 8:50 pm
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:

Use [URL] BBCode for External Links
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
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: 3156
Location: Tucson AZ

PostPosted: Mon Mar 19, 2007 2:12 pm
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 Developer


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

PostPosted: Mon Mar 19, 2007 9:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top