Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
jkri

New User

Joined: 24 Jul 2007
Posts: 17
Location: pune

 Posted: Fri Nov 27, 2009 2:43 pm    Post subject: Absolute value of number 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?

Garry Carroll

Senior Member

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

Posted: Fri Nov 27, 2009 2:53 pm    Post subject:

You could use the RIGHT function

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

Garry
expat

Global Moderator

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

 Posted: Fri Nov 27, 2009 2:53 pm    Post subject: RIGHT
PeterHolland

Global Moderator

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

 Posted: Fri Nov 27, 2009 2:54 pm    Post subject: 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.
prino

Senior Member

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

Posted: Fri Nov 27, 2009 2:58 pm    Post subject:

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.
jkri

New User

Joined: 24 Jul 2007
Posts: 17
Location: pune

 Posted: Fri Nov 27, 2009 3:00 pm    Post subject: Thanks Garry.
jkri

New User

Joined: 24 Jul 2007
Posts: 17
Location: pune

 Posted: Fri Nov 27, 2009 3:07 pm    Post subject: 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.
PeterHolland

Global Moderator

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

 Posted: Fri Nov 27, 2009 3:17 pm    Post subject: You being the following : Occupation: software engineer Mainframe Skills: cobol,jcl,rexx,db2,cics Couldnt you find out that for yourself?
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

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

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us