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
-
GET_BIT
Script function that checks if a bit is set in a bit field
Return code: 0 if the bit is set, 1 if the bit is not set -
Number
Number to convert into a binary format (bit field)
Format: number or script variable -
Bit Position
Position within a bit field to check, always counted from the right
Format: script literal, script variable or number specified without quotation marks
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: