Script function: Checks if a bit is set in a bit field.
GET_BIT(Number, Bit Position)
Syntax |
Description/Format |
---|---|
Number |
Number to be converted into a binary format (bit field). |
Bit position |
Position within the bit field which should be checked. |
Return code |
---|
"0" - Bit is set |
This script function converts the number - which is given with the first parameter - into a binary format. The result is a so-called bit field. Subsequently, it checks if the bit is set at the specified position.
The Bit Position is always counted from the right.
This script function is also used to request the 16 bit field MSG_DESCRIPTOR, MSG_LEVEL and MSG_MISC of a console message in z/OS. These can also be directly queried with the script function GET_CONSOLE.
In the first example, a check is made to determine if the 3rd bit is set in the bit field ("110"). This bit field is the binary format of the number "6". The returned value "1" (bit set) is output to the activation protocol.
:SET &RET# = GET_BIT(6, 3)
:PRINT &RET#
The second example demonstrates checking a component of the console message in z/OS. The returned number is subsequently converted to binary and checked in bit position 3.
:SET &RET# = GET_CONSOLE("MSG_DESCRIPTOR")
:SET &RET# = GET_BIT(&RET#, 3)
See also:
Script element | Description |
---|---|
Reads message data of an occurred console event. |
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function