MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

formatting decimal nembers as non decimal

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Tue Jan 18, 2005 8:54 pm    Post subject: formatting decimal nembers as non decimal Reply with quote

I have dollar amounts of various sizes..

1234.87
2.87
32.99

as examples...

Ids there a quick way in REXX to reformat AMY dollar amount so they look like

123487
287
3299

essentially just remove te decimal point.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jan 19, 2005 9:19 am    Post subject: Reply with quote

John corbin,

try this

Code:

/* REXX */                             
AMTI = '2.87'                         
NUM1 = LEFT(AMTI,LENGTH(AMTI)-3)       
NUM2 = SUBSTR(AMTI,LENGTH(AMTI)-1)     
AMTO = NUM1||NUM2                     
SAY AMTO                               


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Wed Jan 19, 2005 11:24 am    Post subject: Reply with quote

John corbin,

Try this:

Code:

/* REXX */
Amt = 1234.87
Amt = space(translate(Amt,'','.'),0)
Back to top
View user's profile Send private message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Thu Jan 20, 2005 6:45 pm    Post subject: Reply with quote

Thanks to both of you...

both suggestions are great... actually forgot about using the Translate function.
Back to top
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Fri Jan 21, 2005 12:42 am    Post subject: Reply with quote

One more Simple solution,

Multiply the No by 100, remove the last 3 digits.

Example;

AMTI = '2.87'
AMTO = AMTI * 100
SAY SUBSTR(AMTO,1,LENGTH(AMTO)-3)
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Fri Jan 21, 2005 10:07 am    Post subject: Reply with quote

Shivaraj's solution can further simply to:

Amt = 2.87
say Amt * 100 % 1
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group