10 pts.
 ILE RPG
i want to move a numeric field(15,2) to a character field of length 15. i want the character field output with decimal points... For example ...>Input-----> A=123 , B is a character if i move numeric A to character B,character OUTPUT B should be 0000000000123.00

Software/Hardware used:
ASKED: December 15, 2007  4:50 PM
UPDATED: December 17, 2007  1:38 PM

Answer Wiki:
If I'm understanding you correctly, you need to size the character field as one byte larger than the number of numeric digits in order to accomodate the desired decimal point and the edit word one byte larger still in order to avoid suppression of the leading 0. The following will then store the 16 bytes '0000000000123.00' into the character field: <pre> dNumber s 15 2 inz(123) dChar s 16 /free Char = %triml(%editw(Number :'0 . ')); dsply Char; *inlr = *on; return; /end-free </pre>
Last Wiki Answer Submitted:  December 16, 2007  12:22 pm  by  bvining   6,055 pts.
All Answer Wiki Contributors:  bvining   6,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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