In the Jan 11, 2005 SDN downloadable code sample for converting a Binary number to a Decimal number, form validate_data checks each individual byte of a field called "val" to determine if it is a '1' or '0'.
Instead, another way to do this (I think simpler and more efficient) is to use the CO operator as in the following example:
parameters: p_bin type i.
data: val type string.
val = p_bin.
if val co ' 01'. " Notice the space
The number is binary
else.
The number is not binary
endif.
Just my two-cents worth.
Best Regards,
James Gaddis
Add a comment