Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Mon Oct 06, 2008 11:12 am Post subject: |
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123456 1000
123456 1500
123457 1000
123459 4000
123457 1000
123459 5000
123459 6709
123457 1000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,6,CH,A)
OUTFIL REMOVECC,
SECTIONS=(1,6,
TRAILER3=(C'TOTAL SUM=',
TOT=(9,4,ZD,TO=ZD,LENGTH=5)))
/*
|
SORTOUT will have:
Code: |
123456 1000
123456 1500
TOTAL SUM=02500
123457 1000
123457 1000
123457 1000
TOTAL SUM=03000
123459 4000
123459 5000
123459 6709
TOTAL SUM=15709
|
I used TO=ZD,LENGTH=5 for the SUM value. If you want the SUM value in some other form, show exactly what you want for the TOTAL SUM= line, keeping in mind the largest value you can have for the totals (5 digits in your example). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|