The DFSORT job I gave was based on the original poster's input and works with that input. There are two critical differences between your input and the original posters input that prevent the original job from working with your input.
First, the original date was in the form mmddyyyy whereas your date is in the form yyyymmdd. Second, the sum for the amounts in the original input did not exceed 5 digits whereas yours do exceed 5 digits. If you look at your DFSMSGS output, you'll see:
ICE152I 0 OVERFLOW DURING SUMMATION - RC=0
This indicates that your sum values overflowed so the records could not be summed.
Here's a revised DFSORT/ICETOOL job that works with your different input:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB)
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
* Sort on name and yyyymmdd.
//CTL2CNTL DD *
* Sort on name.
* Sum on 6-byte amount to prevent overflow.
Thank You for the reply.
If I give leading zeros to my input sum fields, then the program is able to display the sum in 6-Byte Field. If I don't give leading zeros in my input sum fields, then S0C7 abend is happening.
But the same problem is happening when I change my input sum fields.
When my input is :
name date amount
nayankumar 20070101 999000
nikhilkumar 20070202 440000
nayankumar 20070102 889000
nikhilkumar 20070215 330000
nayankumar 20070215 888000
Thanks to Frank,reddy and guptae for the quick response,but my issue is not yet resolved.The reason behind that is the amount field having comma( ,) as below:
I am recieving the amount fields in the char format
so my records are in the following format:
name date amount
nayankumar 01012007 12,000.00
nikhilkumar 02022007 13,000.00
nayankumar 01022007 12,000.00
nikhilkumar 02152007 13,000.00
nayankumar 02152007 12,000.00
the first control card
SORT FIELDS=(1,15,CH,A,24,4,CH,A,20,4,CH,A) works well.
but when i use the second control card:
SUM FIELDS=(38,5,ZD) ........it abends with S0C7 error.
i also tried using SUM FIELDS=(38,5,CH)...but its giving me jcl error....and i guess it wont work as well.
Can anyone of you suggest me what do i need to do in this case?
It's difficult to hit a moving target. I don't know if you got the 0C7s with just blanks and digits (you wouldn't with DFSORT) or with commas and decimal points (you would).
At any rate, you can't use ZD format for values with commas or decimal points. You have to use UFF format to convert the values to ZD values, SUM them and then reformat them back to their original form. Here's a revised DFSORT/ICETOOL job. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.