Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Summing a whole file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Summing a whole file
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 Moderator


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

PostPosted: Thu Dec 22, 2005 2:05 am    Post subject:
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    Post subject: Re: Summing a whole file
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 Moderator


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

PostPosted: Thu Dec 22, 2005 10:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us