09-16-2008 3:04 PM
hi,
i have 2 variables, one of type char 30 and another char 10. One has a value 0.220 and another has 0.22.
When I compare these two values, it seems it fails.
If var = var2.
endif.
Is there a way where i can convert one of these into a format of the other just before comparing ? i cannot change the data types of these variables now as it will affect many parts of the related programs. I just need to typecast them to same width for comparison purpose only. any tips ?
thks
09-16-2008 3:09 PM
hi,
if these character type variables always contain numbers with decimals, than I would suggest to define variables type p with some decimals. Than move the values to these p variables and then you can compare.
hope this helps
ec
09-16-2008 3:09 PM
hi,
if these character type variables always contain numbers with decimals, than I would suggest to define variables type p with some decimals. Than move the values to these p variables and then you can compare.
hope this helps
ec
09-16-2008 3:12 PM
Hi,
I am not sure , You can try this way-
data:w_char1(30) type c value '0.220',
w_char2(10) type c value '0.22'.
if w_char1 CS w_char2.
write:'OK'.
endif.