SIGN_EXTEND: PROCEDURE OPTIONS (MAIN); DECLARE LIB$EXTV ENTRY (FIXED BINARY (31), /* Address of longword containing /* beginning bit position */ FIXED BINARY (7), /* Address of byte containing size /* of field */ FIXED BINARY (31)) /* Address of field */ RETURNS (FIXED BINARY (31)); /* Return value */ DECLARE (VALUE, SMALL_INT) FIXED BINARY (31); ON ENDFILE (SYSIN) STOP; DO WHILE ('1'B); /* Loop continuously, until end of file */ PUT SKIP(2); GET LIST (VALUE) OPTIONS (PROMPT ('Value: ')); SMALL_INT = LIB$EXTV ( 0, 4, VALUE); /* Extract and sign-extend /* first 4 bits */ PUT SKIP LIST (VALUE, SMALL_INT); END; END SIGN_EXTEND;