View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I am trying below SORT but don't get expected results !? I am adding up values shown at 3rd column based on key at 1st position and write the sum to output. I get right output on key C only Everything else is wrong
Code: |
//DUPKEY01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTXDUP DD SYSOUT=*
//SORTIN DD *
B 333333
B 999999
A 111111
A 999999
C 111111
C 222222
C 333333
//SYSIN DD *
SORT FIELDS=(1,1,CH,A)
DUPKEYS SUM=(3,6,ZD),XDUP
//
|
Results from above job:
Code: |
A 111111
A 999999
B 333333
B 999999
C 666666
|
Expected Results:
Code: |
A 1111110
B 1333332
C 0666666
|
Please help.
Thanks in advance. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Do an inrec overlay to convert the 6 digits to 7 and then do a SUM FIELDS |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
Thanks for the super idea and I've got the results..
Code: |
//SYSIN DD *
INREC BUILD=(1,2,C'0',3,6)
SORT FIELDS=(1,1,CH,A)
DUPKEYS SUM=(3,7,ZD),XDUP
|
|
|
Back to top |
|
|
|