|
|
| Author |
Message |
sreelatha16
New User
Joined: 26 Jun 2008 Posts: 2 Location: bnglore
|
|
|
|
Hi
I have 2 colums in my table 1) job id and 2)salary
Note : job id's are not unique
I need to sort job id in ascending order and give the sum of the salaries relating to the same job id
Please help me out |
|
| Back to top |
|
 |
References
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8746 Location: 221 B Baker St
|
|
|
|
Hello,
Please look in the forum for a proper way to post your question. There are many examples similar to what you want to do in the JCL and DFSORT sections of the forum.
Do you really mean a "table" or is your input a sequential file?
Which sort product is used on your system? |
|
| Back to top |
|
 |
Anuj D.
Global Moderator
Joined: 22 Apr 2006 Posts: 2232 Location: Phoenix, AZ
|
|
|
|
Hi,
To fetch good answer for any SORT problem, the best way is to show the input with some sample records & expected output, with their LRECL & RECFM. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 249 Location: USA
|
|
|
|
Here is a simple example which you can modify to suit your actual data:
| Code: |
//SORT EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SORTIN DD *
123 61000
456 38000
123 35000
789 80000
456 56000
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,ZD,A)
SUM FIELDS=(5,5,ZD)
/* |
This is the output produced form the above example:
| Code: |
123 96000
456 94000
789 80000 |
|
|
| Back to top |
|
 |
|
|