PUT-BITS statement

Uses the bit representation of an integer to set a given number of bits at a given location within another integer.

Syntax

PUT-BITS ( destination , position , numbits ) = expression
destination
An ABL integer variable. The statement sets bits in destination that correspond to the bits that are on in the source variable, expression. It clears bits in the destination variable that are 0 in the source variable. Note that the number of bits set or cleared is limited by the numbits parameter, and the location within the destination is determined by the position variable.
position
A variable or expression that returns an integer. This parameter designates the position of the lowest-order bit of the bits that are to be interpreted as an integer. Bits are numbered from 1 through the length of an integer; with 1 being the low-order bit. If position is greater than the length of an integer or less than 1, the AVM generates a run-time error.
numbits
The number of bits to examine when generating the return value. If position plus numbits is greater than the length of an integer plus 1, the AVM generates a run-time error.
expression
A source variable that returns an integer. If the integer cannot be represented in the number of bits specified by numbits, the AVM stores the low-order numbits bits of the integer.

See also

GET-BITS function