SET BIT

SET BIT

Additions:
1. ... TO g

Effect

The nth bit (from the left, starting at 1) of field f is set to 1.
n must be positive, and either have type I or be convertible into this type. The value of n must not exceed the length (in bits) of f.
f must have type X . It can be of any length up to the maximum permitted for data type X.

SY-SUBRC <> 0:

The value of n was greater than the length in bits of f.

Effect

You can use the ... TO g addition to determine the value to which the bit should be set. g must have the value 1 or 0.

Example

DATA F(2) TYPE X. 
SET BIT 1 OF F. 
WRITE F.

Output: 8000

Related

GET BIT, Bit operations