On Tue, 2 Aug 2022 06:50:10 -0500, Lionel B. Dyck <[email protected]> wrote:

>What is the best way to test if a bit is 1 or 0?
>
>
>
>I'm doing this but was thinking there may/probably is a better way:
>
>
>
>If substr(x2b(c2x(flag1)),6,1)  = 1 then say 'got  it'
>
>
>
>
>
>Lionel B. Dyck <><

Assuming flag1 is a one byte field:
If BitAnd(flag1,'40'x) == '40 × Then Say 'got it'

Make sure you use exactly equal (==) especially when testing for hex 40!

-- 
Dale R. Smith

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to