GET_BIT

Use the GET_BIT script function to convert a number into a binary format, resulting in a bit field. The script function checks if the bit is set in a specified position.

Tip: You can also use this script function to request the 16-bit MSG_DESCRIPTOR, MSG_LEVEL and MSG_MISC field of a console message in z/OS. although you can query those fields directly with the GET_CONSOLE script function. For more information, see GET_CONSOLE, GET_EVENT_INFO.

Syntax

GET_BIT (Number, Bit Position)

Parameters

Examples

In the following example, the script function checks whether the third bit is set in the bit field (110). The bit field in this example is the binary format of the number 6. The script also outputs the returned value (1, the bit set) to the activation report.

:SET &RET# = GET_BIT(6, 3)
:
PRINT &RET# 

The first script function in the following example checks a component of the console message in z/OS. The second script function converts the returned number to binary and checks it in bit position 3.

:SET &RET# = GET_CONSOLE("MSG_DESCRIPTOR")
:
SET &RET# = GET_BIT(&RET#, 3)

See also:

seealso

Arithmetic Calculations in Scripts