Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numeric editted display 2

Status
Not open for further replies.

mikerexx

MIS
Aug 4, 2009
23
US
I am using ISPF with REXX to display calculate and display a number. The number calculated is something like 123456789.05. I want it to display 123,456,789.05... or even better $123,456,789.05

Does anyone know how to do this easily?
 
Probably not exactly what you are looking for, but:

The easiest way i know is to call a cobol module to edit the field(s) and return the reformatted value(s).
 
Thanks for the reply... but there's got to be a better way.
 

There is. First, reverse the field, then TRANSLATE it into the form you need, the reverse the result:
Code:
val = '12345678.90'
valr = Reverse( val )
valr = Translate( 'abcdef,ghi,jkl,mno,pqr,st',,
                  valr,,  /* c is the decimal point */
                  'abcdefghijklmnopqrst' )
saveval = valr
do forever
   saveval = Strip( saveval )
   saveval = Strip( saveval,,"," )
   if valr = saveval then leave
   valr = saveval
end
say reverse( valr )
The order of the STRIPs is significant.


Frank Clarke
--America's source for adverse opinions since 1943.
 
rexxhead,
That works great. Very creative. Thank you.

But, wow. I would think that rexx or ispf would take care of this without forcing the programmer to code this kind of logic.
 
IMHO - REXX/ISPF are fairly worthless when the requirement is "business arithmetic". Maybe there will be some added functionality someday.

And if one has the cpu sales concession, this will surely generate more revenue<g>.
 

Any general purpose language will be 'worthless' for something. You'll get more traction complaining about the way circuses mistreat unicorns.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Not a complaint - just a statement. . .

"Any general purpose language will be 'worthless' for something."
Yup, and typically should not be used for those situations.



 
Not a complaint - just a statement. . .

"Any general purpose language will be 'worthless' for something."
Yup, and typically should not be used for those situations.

Right. Drop into {x}-language where the function is well-handled, and screw it all up because you only use that language once every five years. Plus, the programmer who next maintains the app says "wtf?" because s/he doesn't know as much about {x} as you (think you) do.

I think it might be worth the small loss of efficiency to keep it all in the same tongue where, at least, you know the manuals are close-by.

YMMV, or as the Romans used to say 'de gustibus non disputandum est'. ;-)


Frank Clarke
--America's source for adverse opinions since 1943.
 
Here's another solution

num = '12345678.90'
do c=pos('.',num'.')-4 to lastpos('-','-'num) by -3; num=insert(',',num,c);end
say num

 
On another note. . . If someone can help. . .

If i look at the original post and all of the replies, all of them (except mine<g>) have 3 "links" at the bottom. Mine only have 2. How is the "thank userid for . . ." link added?

I've sent a few notes to the admins and have received no replies.

Maybe if i add this to the topics where i participate, someone will be able to provide a bit of guidance. It is probably something i did wrong when registering. . .

Thanks.
 

You can't thank yourself for a great post.

All the posts on here (except mine) have three links. My own have but two.


Frank Clarke
--America's source for adverse opinions since 1943.
 
You can't thank yourself for a great post."

D'oh. . . [blush] Dain brammage is taking over. . .

Thanx
 
Excellent papadba, easily worth a star for entertainment value alone. There is a fine line between comedy and tragedy, usually drawn around whether it is happening to you or someone else...

You might also ask why you would want to 'red flag' your own posts, and this might be pertinent in this instance. As Tek-Tips doesn't allow you to edit your posts, if you make a typo or some other gaffe, you can red flag to have it deleted by the admins so you can re-post... [smile]

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Oh, sure. . .

" you can red flag to have it deleted by the admins so you can re-post..."

I said to myself, "Self. . . Definitely one i'll repost. . ." Yeah, right [wink]

and it is not even Friday.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top