× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Don,

>From Paul's post:

<snip>
To do an equivalent of TESTB '3' (which tests the fourth bit from the
left)
you would need to do a:

bit3ison = %BitAnd(YourField:X'10') = X'10';

where bit3ison is a named indicator field.
</snip>

It's reasons like this that I think it's a good idea to encapsulate your
"bit-twiddling" into a routine or two - even if you only need to check
one bit, it still seems more understandable (not only to you, but to the
others who will follow) to convert a field into a structure of
bit-indicators and then check those:

D BitDS          DS
D   Bit0                   N
D   Bit1                   N
D   Bit2                   N
D   Bit3                   N
D   Bit4                   N
D   Bit5                   N
D   Bit6                   N
D   Bit7                   N

C               Eval          BitDS = bitform( YourField : 1 )
C               If            Bit3 = *On
...
C               Endif 

than use %bitand:

bit3ison = %bitand(YourField:X'10') = X'10'; 
if bit3ison;
...
endif;

Plus you can use it on fields > 1-byte long - very useful for the nasty
API's like QDFRTVFD, which return multi-byte fields of bits.

In fact, given that lots of bit-twiddling processing involves IBM API's
anyway, you may as well go ahead and define structures for all of
them...

JM2CW,

Rory


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.