Change numeric field to character field in free-format RPGLE program

1215 pts.
Tags:
AS/400
RPGLE
I wanted to change Numeric Field to Character field. I am using Free format RPGLE Program. I have used %Char to do this operation. It is moving 2 to Character field, While trying to move 02 to Character field. I am expecting '02' in Character field. How to achieve this in Free format RPGLE Program?

Answer Wiki

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

if the value is always positive integer
CharFld = %editc( decFld : ‘X’);

otherwise perhaps
$editw( MyFld : ’0 . ‘);

Phil

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ASWDEVELOPER
    use a data structure with the numeric field "redefined" as a character field ... move your numeric field to the data structure numeric field ... then take the value in the data structure character field ... D DS D NUM 1 2 0 D CHAR 1 2
    405 pointsBadges:
    report
  • philpl1jb
    that sould have been CharFld = %editw( MyFld : '0 '; Phil
    50,205 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following