‎2007 Jul 17 8:07 PM
Hi,
I have two variables of CHAR 2.
ie
var1 = 19
var2 = 3
I need to check
if var1 gt var2.
endif.
The above condition is failing ?
Thanks
Sa_r
‎2007 Jul 17 8:09 PM
‎2007 Jul 17 8:09 PM
‎2007 Jul 17 8:12 PM
Again, if these fields must be character, then you will need to have leading zeros in the fields in order to do the conditional statement, otherwise you can make them numeric fields or integar fields and do the condition. Here is an example of what you can do if these fields must remain as character.
report zrich_0001 .
data: var1(2) type c value '19'.
data: var2(2) type c value '3'.
data: n(2) type n.
* Convert the character fields to numeric and back
n = var1.
var1 = n.
n = var2.
var2 = n.
* Now do condition statement.
if var1 > var2.
write:/ 'Var1 is > var2'.
else.
write:/ 'Var1 is not > var2'.
endif.
Regards,
Rich Heilman
‎2007 Jul 17 8:15 PM
Rich,
You answer works well....
I need not to be changed the char to numeric , Instead of i used UNPACK to fill character 0 before the value.
Thanks
Sa_R