120 pts.
 Moving zeros to preceeding empty spaces on numeric field
Hi I am facing issue with my rpgle free format code. I have a numeric field named myNum of length 7,0 and it stores the value 12345 in it. Now I need to move it to the character field named myChar of length 7 and the result to be displayed as '0012345'. I have tried this with %editW keyword but I am getting error RNF7059 again and again. Could any one please help me in getting out of this problem. Any sample code provided would be really helpful. Thanks, Vivek Sharma

Software/Hardware used:
RPGLE
ASKED: May 16, 2012  3:21 PM
UPDATED: May 25, 2012  5:55 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

as long as myNum is positive:

myChar = %editc(myNum:'X');
 7,205 pts.

 

you wouldn’t get the ‘-’ sign if it was negative

 7,205 pts.

 

…and the result to be displayed as ’0012345′.

Just use %ABS() to assign the value to a zoned-decimal field that OVERLAYs your character field.

Tom

 110,115 pts.

 

Hi
Thanks a ton for all your help.

My question has been answered.

- Vivek

 120 pts.