| Free-Form Syntax | (not allowed - use the%BITAND and %BITNOT built-in functions. See Figure 196.) |
| 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.
Factor 2 can contain:
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.
* Set off bits 0,4,6 in FieldG. Leave bits 1,2,3,5,7 unchanged. * Setting off bit 0, which is already off, results in bit 0 remaining off. * Factor 2 = 10001010 * FieldG = 01001111 (before) * FieldG = 01000101 (after) C BITOFF '046' FieldG * Set off bits 0,2,4,6 in FieldI. Leave bits 1,3,5,7 unchanged. * Setting off bit 2, which is already off, results in bit 2 remaining off. * Factor 2 = 10101010 * FieldI = 11001110 (before) * FieldI = 01000100 (after) C BITOFF BITNC FieldI * HEXNC is equivalent to literal '4567', bit pattern 00001111. * Set off bits 4,5,6,7 in FieldK. Leave bits 0,1,2,3 unchanged. * Factor 2 = 11110000 * FieldK = 10000000 (before) * FieldK = 00000000 (after) C BITOFF HEXNC2 FieldK C RETURN