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
 

 

Sum values along the Row.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sum values along the Row.
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 Moderator


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

PostPosted: Fri Jan 09, 2009 10:13 pm    Post subject:
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    Post subject: Reply to: Sum values along the Row.
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 Moderator


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

PostPosted: Mon Jan 12, 2009 9:23 pm    Post subject:
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    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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


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