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 non currency values to currency values

 
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: Mon Oct 18, 2004 12:35 pm    Post subject: Formatting non currency values to currency values Reply with quote

Using TSO REXX

I have numbers like

1234567
88775433
88990000765

that I want to format like

$12345.67
$887754.33
$889900007.65

Note that I am never sure that the length of the raw data is the same.

Here is what I am trying:

IF LINE114 <> "###########" THEN DO
A = LENGTH(rawdata)
A1 = INSERT(DecimalSymbol,LINE114,1+(A-2))
A2 = DollarSymbol||A1
A3 = LEFT(A2,15)
A4 = "Refund Amount = "||A3
J = J + 1
detail.J = account||startdt||enddt||A4
END

It seems to not work.... I get output like:

$12345.67
$88775.433
$8899000.0765

I can see no real pattern to the way it is working...

Can anyone think of a better way ?
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Mon Oct 18, 2004 12:56 pm    Post subject: Reply with quote

The INSERT of the decimal point goes at LENGTH - 2:
Code:

A = Length(rawdata)
A1 = Insert(DecimalSymbol,LINE114,(A-2))
A1 = Insert(DollarSymbol,A1,0)
A1 = Left(A1,15)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Oct 18, 2004 1:12 pm    Post subject: Reply with quote

John_corbin,

Try this

Code:

/* REXX */                             
AMTI = '1234567'                       
NUM1 = LEFT(AMTI,LENGTH(AMTI)-2)       
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
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Tue Oct 19, 2004 8:36 am    Post subject: Reply with quote

Much thanks to all...

both suggestions worked and I appreciate the help
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