convert Double Precision number (8F)
How would I convert a Double Precision number (that is 8F). I am using a random number generator that return the random number in this field define as 8F. I need to have the result be move to a 5 character field for printing on a label.

Software/Hardware used:
ASKED: April 28, 2009  5:15 PM
UPDATED: April 29, 2009  1:01 PM

Answer Wiki:
Hi AS400PCFileTransfer16 The demo code below assumes that your random number generator creates a number from 0 to .99999999999999999 1. Convert to signed or packed 2. Convert to character 3. Substring to desired length D valuef8 s 8f inz(0.1234567891) D values150 s 15s 0 D valuec15 s 15a D valuec5 s 5a C valuef8 dsply C eval values150 = valuef8 * 1000000000000000 C values150 dsply C eval valuec15 = %editc(values150 : 'X') C valuec15 dsply C eval valuec5 = %subst(valuec15 : 1 : 5) C valuec5 dsply C C eval *inof = *on C return Phil
Last Wiki Answer Submitted:  April 29, 2009  1:01 pm  by  philpl1jb   44,070 pts.
All Answer Wiki Contributors:  philpl1jb   44,070 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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