Previous Topic: Comment Statement

Next Topic: Examples

Bit Test Statement

The bit test statement is a type of IF, SELECT, or IGNORE statement that allows you to test individual bits in a flag field. The flag fields for the products are described in the data definition tables.

The syntax is as follows:

IF [NOT] fldname HAS {ANY|ALL} BITS {ON|OFF} mask.
NOT

Reverses the result of the bit test statement.

fldname

Specifies the name of the field to be tested. Only the first byte is tested. The field must have a data type of BIT or A/N.

ALL BITS ON

Specifies that all of the bits shown as 1 (on) in the mask are 1 in the field. ALL BITS ON is the negation of ANY BITS OFF.

ALL BITS OFF

Specifies that all of the bits shown as 1 (on) in the mask are 0 (off) in the field. ALL BITS OFF is the negation of ANY BITS ON.

ANY BITS ON

Specifies that at least one of the bits shown as 1 (on) in the mask has a corresponding bit on in the field.

ANY BITS OFF

Specifies that at least one of the bits shown as 1 (on) in the mask has a corresponding bit off in the field.

mask

Specifies a mask made up of two hexadecimal digits (0-9 or A-F). You can use 'ab' format or X'ab' format, where 'ab' are hexadecimal digits.