Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 LOW VALUES as a KEY juares castro DB2 10 Sat Apr 07, 2018 1:06 am
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts attchmvs from rexx subroutine that re... harisukumaran CLIST & REXX 1 Fri Jan 19, 2018 5:29 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 1 Tue Sep 12, 2017 1:42 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us