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.
Joined: 15 Feb 2005 Posts: 7129 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.