SORT JCL to SUM up values
SORT JCL to SUM up values
If you wish to sum up the values at a particular position sorted at some value then you can use the following sort card
The following card will sum values (lets assume salaries) appearing at pos 7th (4 bytes) grouped/sorted on data (emp numbers)
at 37th position of 10bytes.
SORT FIELDS=(37,10,CH,A),STOPAFT=10
SUM FIELDS=(7,4,ZD)
Example JCL is provided below.
; ; ; ;
//SETP001 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//REPORT1 DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=USERID.ABC.INPFILE,
//SORTOUT DD DSN=USERID.ABC.OUTFILE,
// DISP=(,CATLG),
// SPACE=(TRK,(30,10),RLSE),
// UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SORTWK03 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SYSIN DD *
SORT FIELDS=(37,10,CH,A),STOPAFT=10
SUM FIELDS=(7,4,ZD)
/*
//*
Comments
Anonymous
Sat, 08/27/2011 - 08:38
Permalink
IT WONT WORKING
The above syntax is not executing. After the execution the fields wont be sum only sorting fields has displayed.
Anonymous
Sat, 01/21/2012 - 05:54
Permalink
It doesnt work
It doesnt work
Anonymous
Mon, 01/21/2013 - 09:42
Permalink
its working when changeD the
its working when changeD the 'STOPAFT=10'
to 'FORMAT=CH'