View previous topic :: View next topic
|
Author |
Message |
lekshmi_ci
New User
Joined: 14 Mar 2007 Posts: 60 Location: Thiruvananthapuram
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I would think so, what is your doubt? |
|
Back to top |
|
|
lekshmi_ci
New User
Joined: 14 Mar 2007 Posts: 60 Location: Thiruvananthapuram
|
|
|
|
just want the format...how to do this grouping..taking this input file as an example.. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
lekshmi_ci
New User
Joined: 14 Mar 2007 Posts: 60 Location: Thiruvananthapuram
|
|
|
|
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 |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|