Page 1 of 1

Packed Decimal conversion

Posted: Sat May 28, 2005 11:38 pm
by rhettbutlernc
I need to convert the numbers usually padded with zeros to a packed decimal number (eg:00000123456789).

I am using a routine to do this but all the leading zeros are being stripped.

Code: Select all

InputNbr = Oconv(InputNbr, "MCN")

Ans=iconv(InputNbr, "MP")
Guess this has to do with the Options. I would appreciate if someone could help me...

Thanks.
-Davis

Posted: Sun May 29, 2005 5:37 am
by ray.wurlod
It's the Oconv that's stripping zeroes.

To retain them, wrap in a Fmt function.

Code: Select all

InputNbr = Fmt(Oconv(InputNbr, "MCN"), "R%14")

Posted: Thu Jun 02, 2005 8:22 pm
by rhettbutlernc
The zeros were not being stripped. It was just that the CFF stage not displaying them... I used UltraEdit to view the Hexadecimal equivalent of the leading zeros.

Thanks :)

Posted: Fri Jun 03, 2005 4:35 am
by Sainath.Srinivasan
You can do a trim(yourval, '0', 'L')