emp_nr month/year Amount
000000042 03/2001 E E 001 0.000 328.32
000000042 03/2001 E E 320 0.000 103.63
000000042 03/2001 E E 370 0.000 4.56
000000042 03/2001 E E 400 0.000 -0.01
INREC OVERLAY=(41:41,7,SFF,TO=ZD,LENGTH=7)
SORT FIELDS=(12,7,CH,A)
SUM FIELDS=(41,8,ZD)
OUTREC OVERLAY=(41:41,7,ZD,EDIT=(STTTTT.T),SIGNS=(,-))
for summing the amount for particular year say all the amounts for 1/2001,3/2001,3/2001,
and so on up to 12/2001 but I am not getting the result as expeted
Suppose I have like
000000042 03/2001 E E 001 0.000 328.32
000000042 03/2001 E E 320 0.000 103.63
000000042 03/2001 E E 370 0.000 4.56
000000042 03/2001 E E 400 0.000 -0.01
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Based on what you've said and shown, I believe these DFSORT control statements will give you what you want:
Code:
INREC OVERLAY=(41:41,7,SFF,TO=ZD,LENGTH=7)
SORT FIELDS=(12,7,CH,A)
SUM FIELDS=(41,7,ZD)
OUTREC OVERLAY=(41:41,6,ZD,EDIT=(SIIIIT.T),SIGNS=(,-))
The output I get with your input example is:
Code:
000000042 03/2001 E E 001 0.000 436.5
If you want to remove the '001' field and/or output the fields in different positions, you can use an appropriate BUILD operand instead of an OVERLAY operand to do that.