BITOFF (Set Bits Off)
Code | Factor 1 | Factor 2 | Result Field | Indicators | ||
---|---|---|---|---|---|---|
BITOFF | Bit numbers | Character field |
The BITOFF operation causes bits identified in factor 2 to be set off (set to 0) in the result field. Bits not identified in factor 2 remain unchanged. Therefore, when using BITOFF to format a character, you should use both BITON and BITOFF: BITON to specify the bits to be set on (=1), and BITOFF to specify the bits to be set off (=0). Unless you explicitly set on or off all the bits in the character, you might not get the character you want.
If you want to assign a particular bit pattern to a character field, use the MOVE (Move) operation with a hexadecimal literal in factor 2.
- Bit numbers 0-7: From 1 to 8 bits can be set off per operation. They are identified by the numbers 0 through 7. (0 is the leftmost bit.) Enclose the bit numbers in apostrophes. For example, to set off bits 0, 2, and 5, enter ‘025’ in factor 2.
- Field name: You can specify the name of a one-position character field, table element, or array element in factor 2. The bits that are on in the field, table element, or array element are set off in the result field; bits that are off do not affect the result.
- Hexadecimal literal or named constant: You can specify a 1-byte hexadecimal literal or hexadecimal named constant. Bits that are on in factor 2 are set off in the result field; bits that are off are not affected.
- Named constant: A character named constant up to eight positions long containing the bit numbers to be set off.
In the result field, specify a one-position character field. It can be an array element if each element in the array is a one-position character field.
For more information, see Bit Operations.