×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Numeric editted display
2

Numeric editted display

Numeric editted display

(OP)
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?

RE: Numeric editted display

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

RE: Numeric editted display

(OP)
Thanks for the reply... but there's got to be a better way.

RE: Numeric editted display


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.

RE: Numeric editted display

(OP)
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.

RE: Numeric editted display

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

RE: Numeric editted display


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.

RE: Numeric editted display

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.



 

RE: Numeric editted display

Quote:

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'.  winky smile
 

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

RE: Numeric editted display

Here's another solution

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

 

RE: Numeric editted display

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.

RE: Numeric editted display


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.

RE: Numeric editted display

"You can't thank yourself for a great post."

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

Thanx

RE: Numeric editted display

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

"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)

RE: Numeric editted display

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close