February 28, 2007, 10:11 AM
manashconversion from packed to alphanumeric excluding the decimal point and comma.
1) I have a packed field var1 of format P8.2.
I want to convert it to alphanumeric format of A7.
Ex var1= 12345.67
I want it as var2(A7)=1234567.
I want to eliminate the decimal point.
Any help?
I had used 'ftoa' function to convert from decimal to alpha but the problem is that i am getting comma. how to eliminate it?
Ex = 12,345
February 28, 2007, 10:18 AM
smithsLook into PTOA. I'm pretty sure there were several posts previously on this.
Sean
February 28, 2007, 10:25 AM
BlueZoneManash :
If nothing else works, this will...
DEFINE FILE CAR
FLD1/P8.2 WITH SALES = 12345.67;
FLD2/I8 = FLD1 * 100;
FLD3/A7=EDIT(FLD2,'$9999999');
END
TABLE FILE CAR
PRINT FLD1 FLD2 FLD3
WHERE READLIMIT EQ 1
WHERE RECORDLIMIT EQ 1
END
Gooooooooooood day !!
Sandeep Mamidenna
February 28, 2007, 10:28 AM
Danny-SRLHello Manash,
Try the following. Notice the small "c" if the format of the FTOA function.
VARL/D7=VAR1 * 100;
VAR2/A7=FTOA(VARL,'(D7c)','A7');
Daniel
www.srl.co.ilFebruary 28, 2007, 11:12 AM
Alan BUse PTOA.
P_Field/P8.2 = 12345.67;
A_Field/A7 = PTOA(P_Field*100,'(P7)','A7');
This will not cause you any issues.
February 28, 2007, 10:46 PM
manashThank you all for your valuable suggestions.
May 13, 2008, 12:22 PM
Ian DaltonUsing the FTOA with a small 'c' after the format ie. D15.2c will convert the long decimal no. without commas - ripper !!