Cecil
19+ years progress programming and still learning.
So I have some simple code which will loop through each bit of an integer and set the bits of a second integer variable, bit-by-bit.
However when it gets to position 32 in the integer it's failing.
However when it gets to position 32 in the integer it's failing.
Code:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE SourceNumber AS INTEGER NO-UNDO.
DEFINE VARIABLE TargetNumber AS INTEGER NO-UNDO format '-9999999999'.
SourceNumber = -9.
/** Working from LSB --> MSB / right to left */
DO i = 1 TO 32:
PUT-BITS(TargetNumber, i ,1) = GET-BITS(SourceNumber, i ,1).
END.
DISPLAY TargetNumber .