Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Comment regarding the Jan 11 Binary to Decimal conversion code sample

Former Member
0 Likes
388

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

1 REPLY 1
Read only

Former Member
0 Likes
346

Hi James,

Thanks for your suggestion, and it was really useful.

Regards,

Kathirvel.