08-02-2006 1:20 AM
Hi folks,
I have some value in a field 'count'. I want to check if the value in that field is even or not. I need to put a IF loop saying that if the value in 'count' is even then execute the loop. How can I do this.
I appreciate the efficient method to check this. Thanks
Waiting.............
08-02-2006 1:29 AM
hi
try using the below logic..
data even type i.
even = count mod 2.
if even eq 0.
<execute your loop here>.
endif.
Cheers,
Abdul Hakim
08-02-2006 1:42 AM
08-02-2006 1:46 AM
You can do something like this.
report zrich_0002 .
data: i type i value 48.
data: remainder type i.
remainder = i mod 2.
if remainder = 0.
write:/ 'This is an even number'.
else.
write:/ 'This is an odd number'.
endif.
Ooops, Abdul beat me to it.
Regards,
Rich Heilman
Message was edited by: Rich Heilman