Page 1 of 1

DFSORT(sum-sort) - Need 1 step solution?

PostPosted: Wed Apr 16, 2008 4:25 pm
by onsy.sifer
I m having one sequential file with following field.

BI511-DIST-CENTER-NAME
BI511-STATE-NAME
BI511-EXT-CVS-COST
BI511-EXT-CIG-SALES
BI511-EXT-ALC-SALES
BI511-EXT-TOB-SALES
BI511-EXT-GROSS-SALES
BI511-MONTH
BI511-YEAR

I need a one step jcl to do following jobs.
1. Sort the file with field of BI511-DIST-CENTER-NAME(alphanumeric and length is 20) and BI511-STATE-NAME (alphanumeric and length is 20)

2. Sum on following field …
BI511-EXT-CVS-COST
BI511-EXT-CIG-SALES
BI511-EXT-ALC-SALES
BI511-EXT-TOB-SALES
BI511-EXT-GROSS-SALES
Note: all the above fields are alphanumeric with length of 18 where first character as Sign (+ or -), next 13 characters are numeric, next is ‘.’ And rest 3 characters are again numeric.

3. Replace BI511-MONTH (alphanumeric and length is 2) field with spaces.


Thanks...

Re: DFSORT(sum-sort) - Need 1 step solution?

PostPosted: Wed Apr 16, 2008 11:41 pm
by Frank Yaeger
Here's a DFSORT job that will do what you asked for:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  INREC OVERLAY=(41:41,18,SFF,TO=ZD,LENGTH=18,
                 59,18,SFF,TO=ZD,LENGTH=18,
                 77,18,SFF,TO=ZD,LENGTH=18,
                 95,18,SFF,TO=ZD,LENGTH=18,
                 113,18,SFF,TO=ZD,LENGTH=18,
                 2X)
  SORT FIELDS=(1,40,CH,A)
  SUM FORMAT=ZD,FIELDS=(41,18,59,18,77,18,95,18,113,18)
  OUTREC OVERLAY=(41:41,18,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(+,-),
                  59,18,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(+,-),
                  77,18,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(+,-),
                  95,18,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(+,-),
                 113,18,ZD,EDIT=(STTTTTTTTTTTTT.TTT),SIGNS=(+,-))
/*