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: 1006
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: 8685
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: 2453
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: 1109
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: 2453
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 Question about dataset sequence numbe... harisukumaran JCL & VSAM 23 Tue May 29, 2018 9:31 am
No new posts INVALID RECFM FOR DDNAME SYSLIN AND C... sandeep kumar302 All Other Mainframe Topics 7 Fri Apr 27, 2018 6:07 pm
No new posts Repeat Sequence Number Until change i... rahulabvp DFSORT/ICETOOL 6 Thu Mar 29, 2018 12:51 pm
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts PARSE GDG name to separate generation... Abid Hasan SYNCSORT 2 Sun Feb 11, 2018 3:40 pm

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