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
 
Absolute value of number

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
jkri

New User


Joined: 24 Jul 2007
Posts: 17
Location: pune

PostPosted: Fri Nov 27, 2009 2:43 pm    Post subject: Absolute value of number
Reply with quote

I have a small query.

I need to calculate sum of 2 numbers.
eg - A = 02, B = 03 ; sum = A+B = 05.

Is it possible to display the sum as 05 instead of 5? Is there any arithemetic function available for that?
Back to top
View user's profile Send private message

Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1002
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Nov 27, 2009 2:53 pm    Post subject:
Reply with quote

You could use the RIGHT function

Code:
  RESULT = RIGHT(sum,2,'0')
  say  RESULT


Garry
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8617
Location: Back in jolly old England

PostPosted: Fri Nov 27, 2009 2:53 pm    Post subject:
Reply with quote

RIGHT
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2445
Location: Netherlands, Amstelveen

PostPosted: Fri Nov 27, 2009 2:54 pm    Post subject:
Reply with quote

Well you are not giving any hint of the kind of language you are
going to use, but you can use SAS for that kind of things.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1072
Location: Oostende, Belgium

PostPosted: Fri Nov 27, 2009 2:58 pm    Post subject:
Reply with quote

  1. What does this have to do with absolute values?
  2. How do you decide if there should be one zero before the five, rather than three or 42?


Code:

/* REXX */
trace ?r
a = 02
b = 03
sum = right(a + b, max(c2d("L==2"), length(a + b), length(a), length(b)), '0')
say sum


Don't remove the "trace ?r", it will show you exactly what is happening. Enjoy. icon_lol.gif
Back to top
View user's profile Send private message
jkri

New User


Joined: 24 Jul 2007
Posts: 17
Location: pune

PostPosted: Fri Nov 27, 2009 3:00 pm    Post subject:
Reply with quote

Thanks Garry.
Back to top
View user's profile Send private message
jkri

New User


Joined: 24 Jul 2007
Posts: 17
Location: pune

PostPosted: Fri Nov 27, 2009 3:07 pm    Post subject:
Reply with quote

Prino,

Nothing with the absolute value. Sorry for the misleading subject line.

My code is doing some update to a list of members whose name ends with number (2 digits) and there are around 80 members. So to get the next member I am adding the current memebr name by 1. So for first 9 members I need to get the value as 01,02..09, for rest it doesnt matter .

Just wanted to know if there are any functions. Thanks for the reply.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2445
Location: Netherlands, Amstelveen

PostPosted: Fri Nov 27, 2009 3:17 pm    Post subject:
Reply with quote

You being the following :

Occupation: software engineer
Mainframe Skills: cobol,jcl,rexx,db2,cics

Couldnt you find out that for yourself?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm

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