10-16-2008 4:05 PM
Hi ,
Is there any FM or any other way to convert hexadecimal ( type xstring) to packed decimal ( type P).
Thanks in advance.
Best Regards,
Gopi
10-16-2008 4:11 PM
1st convert the xstring to string using fm ECATT_CONV_XSTRING_TO_STRING and after that try to convert the string value to decimal by simple assignment.
10-16-2008 4:18 PM
Here's one I prepared earlier today:
DATA value1 TYPE x LENGTH 2 VALUE '0BDF'.
DATA value2 TYPE i.
MOVE value1 TO value2.
WRITE / value2. " Hex converted to integer
DATA value3 TYPE p DECIMALS 2.
value3 = value2. " Convert to type p
WRITE / value3.
Note, the LENGTH for value1 - the hex value - must be the correct number of bytes. And you must have leading 0 if the number of hex digits isn't even.