‎2007 Oct 02 9:58 AM
hi
i have to convert a character value '23.4' into exchange rate format i.e, '00023.4000'
which is also to be stored in char format.
please suggest.
thanks in advance
‎2007 Oct 02 10:15 AM
Hi,
this should be ok.
data: char1(4) type c value '23.4',
char2(10) type c,
char3(10) type c,
dec1(12) type p DECIMALS 3,
int1(5) type c,
dec2(3) type c.
move char1 to dec1.
char2 = dec1.
split char2 at '.' into int1 dec2.
UNPACK int1 to int1.
CONCATENATE int1 '.' dec2 into char3.
CHAR3 has your final format.
Please reward if helpful.
Regards,
George
‎2007 Oct 02 10:23 AM
Hi...adding to the above post.....4 decimals are needed...so please modify code in following places.....
data: char1(4) type c value '23.4',
char2(10) type c,
char3(10) type c,
<b>dec1(12) type p DECIMALS 4,</b>
int1(5) type c,
<b>dec2(4) type c.</b>
move char1 to dec1.
char2 = dec1.
split char2 at '.' into int1 dec2.
UNPACK int1 to int1.
CONCATENATE int1 '.' dec2 into char3.
write 😕 char3.
Regards
Vasu
‎2007 Oct 02 10:43 AM
‎2007 Oct 10 3:13 AM
Thanks to all. the problem is solved now ..
I found that as fixed length was specified so Overlay operation on variable can also be used .