IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Summing a whole file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
janamott

New User


Joined: 22 Dec 2005
Posts: 4
Location: Edison, NJ

PostPosted: Thu Dec 22, 2005 12:45 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Dec 22, 2005 2:05 am
Reply with quote

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
View user's profile Send private message
janamott

New User


Joined: 22 Dec 2005
Posts: 4
Location: Edison, NJ

PostPosted: Thu Dec 22, 2005 8:29 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Dec 22, 2005 10:40 pm
Reply with quote

Glad I could help.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top