Sum Values In a Field based on a key
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Sum Values In a Field based on a key Author: mikemurray PostPosted: Tue Jun 10, 2003 8:08 pm
    —
I've a file:
id-a value1
id-a value2
id-b value3

I want to convert first two records into 1 record (id-a) and change the value field to value1+value2.Please post a solution in syncsort.I want to move the non-duplicate record as it is.

Thanks,
Mike

#2:  Author: coolmanLocation: US PostPosted: Wed Jun 11, 2003 3:05 am
    —
Mike,

The following job should give you the results.

Code:

//STEP1    EXEC PGM=SORT 
//SORTIN   DD *           
ID-A 10                   
ID-A 10                   
ID-B 50                   
/*                       
//SORTOUT   DD SYSOUT=*   
//SYSOUT    DD SYSOUT=*   
//SYSIN    DD *           
 SORT FIELDS=(1,4,CH,A)   
 SUM FIELDS=(6,2,ZD)     
/*                       
//                       



Hope this helps...

Cheers,
Coolman
________
Honda Today



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group