I have an integer counter variable that I move to a character variable of the same size so that I can concatenate it into a message text string. Is there a way to get rid of the leading zeros when i convert from Int to Char?
Announcement
Collapse
No announcement yet.
Leading Zeros
Collapse
X
-
Re: Leading Zeros
When you use
the leading *zeros will be removed.Code:eval mycharfield = %char(mydecimalfield)
to keep them use
Code:eval mycharfield = %editc(mydecimalfield:'X')
All my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
-
Re: Leading Zeros
One possible alternative to the %CHAR built-in function is to use the Z edit code:Originally posted by jamief View PostWhen you use
the leading *zeros will be removed.Code:eval mycharfield = %char(mydecimalfield)
to keep them use
Code:eval mycharfield = %editc(mydecimalfield:'X')
This also removes leading zeros.Code:eval mycharfield = %editc(mydecimalfield:'Z')
"Time passes, but sometimes it beats the <crap> out of you as it goes."
Comment





Comment