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 of amount fields - kindly help!

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Sallymary

New User


Joined: 18 Apr 2007
Posts: 4
Location: Chennai

PostPosted: Wed Apr 18, 2007 1:39 pm    Post subject: summing of amount fields - kindly help!
Reply with quote

To sum amount fields the condition used are

Code:
SORT FIELDS=(1201,6,CH,A)           
INCLUDE COND=(1120,3,CH,EQ,C'90 ',OR,
              1120,3,CH,EQ,C'91 ',OR,
              1120,3,CH,EQ,C'92 ',OR,
              1120,3,CH,EQ,C'94 ',OR,
              1120,3,CH,EQ,C'90R',OR,
              1120,3,CH,EQ,C'90X',OR,
              1120,3,CH,EQ,C'91F',OR,
              1120,3,CH,EQ,C'94Y',OR,
              1120,3,CH,EQ,C'95X')   
SUM  FIELDS=(509,10,ZD)             
OUTREC FIELDS=(1201,6,6C' ',509,10,ZD,M4)


The output generated is having more than one record
File1
Code:
CTSP        +80,931,179.11                                                     
CTSP        +75,103,424.97                                                     
CTSP        +91,613,505.83

But the required output is only a single record like

File2
Code:
CTSP        247648109.91


When we sum up all the amounts in file1 we get the total of file2
but in the former it is getting split
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Apr 18, 2007 1:51 pm    Post subject: Re: summing of amount fields - kindly help!
Reply with quote

Sallymary wrote:
The output generated is having more than one record
But the required output is only a single record like
When we sum up all the amounts in file1 we get the total of file2
but in the former it is getting split
You specify only 10 digits for the total, so SORT is giving you the best it can without truncating the results. If your final total requires 11, maybe you should change your OUTREC.
Back to top
View user's profile Send private message
Sallymary

New User


Joined: 18 Apr 2007
Posts: 4
Location: Chennai

PostPosted: Wed Apr 18, 2007 3:41 pm    Post subject:
Reply with quote

I tried increasing OUTREC field by
OUTREC FIELDS=(1201,6,6C' ',509,12,ZD,M4)



The output is
CTSP +8,093,117,911.00
CTSP +7,510,342,497.00
CTSP +9,161,350,583.00

But the output still remained the same
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Apr 18, 2007 3:55 pm    Post subject:
Reply with quote

Opps, forgot about the SUM field. From the DFSORT manual:
If overflow might occur during summation, INREC can be used to create a larger SUM field in the reformatted input record (perhaps resulting in a larger record for sorting or merging) so that overflow does not occur.
Back to top
View user's profile Send private message
Sallymary

New User


Joined: 18 Apr 2007
Posts: 4
Location: Chennai

PostPosted: Wed Apr 18, 2007 4:19 pm    Post subject:
Reply with quote

ok... william. Kindly help me icon_sad.gif
Back to top
View user's profile Send private message
Sallymary

New User


Joined: 18 Apr 2007
Posts: 4
Location: Chennai

PostPosted: Wed Apr 18, 2007 4:22 pm    Post subject:
Reply with quote

Can u give me an example for the above statement...??
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: Wed Apr 18, 2007 9:13 pm    Post subject:
Reply with quote

Sallymary,

Here's a DFSORT job that will do what you asked for. Note that we add a character 0 (C'0') before your 10 byte ZD field to make it an 11 byte ZD field so it won't overflow.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  INCLUDE COND=(1120,3,CH,EQ,C'90 ',OR,
                1120,3,CH,EQ,C'91 ',OR,
                1120,3,CH,EQ,C'92 ',OR,
                1120,3,CH,EQ,C'94 ',OR,
                1120,3,CH,EQ,C'90R',OR,
                1120,3,CH,EQ,C'90X',OR,
                1120,3,CH,EQ,C'91F',OR,
                1120,3,CH,EQ,C'94Y',OR,
                1120,3,CH,EQ,C'95X')
  INREC FIELDS=(1201,6,13:C'0',509,10)
  SORT FIELDS=(1,6,CH,A)
  SUM  FIELDS=(13,11,ZD)
  OUTREC FIELDS=(1,12,13,11,ZD,M4)
/*
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


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