February 26, 2007, 01:55 AM
<Raghuraman>FOCUS : converting numeric (P13.2) to character(A10)
Hi
i have field in focus like HFCURRSAL data type is P13.2.
I want display to A10 format.
Please how to solve this problem.
February 26, 2007, 02:33 AM
Alan BUse the function PTOA
ALPHASAL/A10 = PTOA(HFCURRSAL,'(P13.2)','A10');
If the value in the P field is greater than can fit in the A field, the value is truncated from the right, i.e 1234567899.12 would become 123456789 . If you use '(P10.2)' and the value is greater *s are shown, which is safer.
February 26, 2007, 04:47 AM
manashhi Alan,
Is there any way to convert from packed to decimal?
Ex- P13.2 to D10.2
February 26, 2007, 04:58 AM
Alan BP to D conversion can be done directly.
DFIELD/D10.2=PFIELD;
As far as I am aware, on the windows platform P fields do not actually exist, so are held as D anyway. In the back of my mind I have a thought about unsigned packed fields causing an issue on mainframe.
It always helps to know your platform and version please manash.