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

Sum values along the Row.


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

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Jan 09, 2009 2:27 pm
Reply with quote

Hi,
I have a requirement to add values in the same row. I know that we can add values along the row by using the ADD function,

Code:

INREC IFTHEN=(WHEN=NONE,           
OVERLAY=(7:1,2,ZD,ADD,3,2,ZD,TO=ZD,LENGTH=2)), 



but my requirement is to add three column's value.

E.G:

A B C D= A+B+C
10 20 30

I need to populate 60 for D. Pls suggest me a method. My I/P file is FB with Lrecl of 80. Is it possible to do a nesting with ADD ?


-Sam
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: Fri Jan 09, 2009 10:13 pm
Reply with quote

Why do you assume you can only add two fields? You can ADD as many fields as you like.

Code:

  INREC IFTHEN=(WHEN=NONE,
   OVERLAY=(7:1,2,ZD,ADD,3,2,ZD,ADD,5,2,ZD,TO=ZD,LENGTH=2)),
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Jan 12, 2009 9:27 am
Reply with quote

Frank, Thanks for your reply. A simple clarification required,

If in case i need to do a MUL, DIV and then ADD, I need to change precedence, can i give the braces () , as we do in any of the programming languages ?

Thanks in Advance.

- Samuel.I.J
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: Mon Jan 12, 2009 9:23 pm
Reply with quote

Quote:
If in case i need to do a MUL, DIV and then ADD, I need to change precedence, can i give the braces () , as we do in any of the programming languages ?


Yes, you can use parentheses () to change the precedence.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
Search our Forums:

Back to Top