Previous Topic: Hexadecimal LiteralsNext Topic: User-Defined Field Names


Bit Masks

In coding a Reporting Facility program, you may need to test the contents of a single byte against a mask. When using a mask in a logical expression, code it in the following format:

►►─ B'testbits' ──────────────────────────────────────────────────────────────►◄
'testbits'

Specifies the mask to be tested. It is comprised of one to eight 1s, 0s, or Xs. Positioning in the mask corresponds to bits 0—7, from left to right, of the byte to be tested against.

Note the following:

Mask in Command

Hex Value

Condition

B'11000000'
B'11101100'
B'00000000'
B'11X1000X'
B'1'
B'X0000000'
B'1110'
B'X0'
B'00'
B'XXX'
B'02'
'01'
B011

X'CO' (11000000)
X'FF' (11111111)
X'00' (00000000)
X'F1' (11110001)
X'82' (10000010)
X'01' (00000001)
X'F0' (11110000)
X'40' (01000000)
X'20' (00100000)
. .
. .
. .
. .

true
false
true
true
true
false
false
false
true
INVALID
INVALID
INVALID
INVALID