|
|
| Author |
Message |
janamott
New User
Joined: 22 Dec 2005 Posts: 4 Location: Edison, NJ
|
|
|
|
Frank, et al,
Can you please help?
I'm trying to sum a particular field (Household Percentage) S9V9(4), column 75 (length = 5).
I don't want to break on a key. Essentially, if this works correctly, I'm expecting an output file with only ONE record. That record should contain the sum for this field in EVERY record on the file (13 million records).
Here is my sysin:
SORT FIELDS=(17,1,A),FORMAT=CH
SUM FIELDS=(75,5,ZD)
Sorting on column 17 for 1 byte is my meek attempt to force a single summary, since col 17 is blank in every record.
Needless to say(?), the result is nothing close to the single sum record I was hoping for.
Please let me know the best way to do this.
Thanks,
Jana |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
If byte 17 is blank in every record, then you would get one record with the sum unless it overflowed 5 ZD digits. Did you get an OVERFLOW message?
There are two ways to take care of the overflow:
1) Use INREC to reformat the records to increase the size of the sum field so it doesn't overflow, e.g. add C'000' before the sum field to increase its size from 5 digits to 8 digits (or whatever it takes).
2) Use COPY with OUTFIL TRAILER1 to get the total and set it to as many digits as you need using M11,LENGTH=n. This is more efficient since you can use a copy instead of a sort.
If you need more specific help, let me know if you did indeed have an overflow, and how big the total can actually get. Show me an example of what the input records look like and what you want the output record to look like. What is the RECFM and LRECL of the input file? If you didn't get an overflow, show me the //SYSOUT messages. |
|
| Back to top |
|
 |
janamott
New User
Joined: 22 Dec 2005 Posts: 4 Location: Edison, NJ
|
|
|
|
Frank,
You're a God-send!
Thank you so much for the solution. I didn't realize the overflow error was causing my problem.
Here's the code that worked -
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=DSNOUT,
NODETAIL,
HEADER1=(1:'FILE SUMMARY',3/,
1:'CU-ACCT-AMT',/,
1:'-----------------'),
TRAILER1=(1:TOT=(51,5,ZD,M11,LENGTH=15))
|
I could have gotten away with Length=11, but...
Thanks again,
Jana |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Glad I could help. |
|
| Back to top |
|
 |
|
|
|