converting a numeric to character

pts.
Tags:
RPG
RPGLE
How do I get a number into char format so I can manipulate the string

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi

In which language? In RPG IV/ILE you would use the edit code built in function:

Eval String = %EditC(Numeric : ‘X’)

Edit code “X” gives you a straight numeric conversion without commas, blanks, etc.

In CL you simply use the CHGVAR command:

CHGVAR VAR(&STRING) VALUE(&NUMERIC)

All the best

Jonathan

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Grinchly
    In RPGIII you can use a simple move. MOVE Num Alpha IN /Free you can use the %CHAR bif Alpha = %char(num); You can also use a data structure Convert DS Num 1 2S 0 Alpha 1 2A
    0 pointsBadges:
    report
  • Ricksmith
    Be aware that if you use the %CHAR bif, leading zeros will be dropped.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: