GET BIT

GET

Effect

The nth bit (from the left, beginning at 1) of field f is placed in the field g.
n must be positive and be convertible into type I. The value of n must not be longer than the length in bits of f.
f must have type X, and can be of any length up to the maximum permitted for type X.

SY-SUBRC <> 0:

The value of n is greater than the length in bits of f. g takes the value 0 in this case.

Example

DATA: F(2) TYPE X VALUE '8000', 
	G	TYPE I. 
GET BIT 1 OF F INTO G. 
WRITE G.

Output: 1

Related

SET BIT, Bit operations