VMS Help Lexicals, F$CVSI, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1.$ A[0,32] = %X2B $ SHOW SYMBOL A A = "+..." $ X = F$CVSI(0,4,A) $ SHOW SYMBOL X X = -5 Hex = FFFFFFFB Octal = 37777777773 This example uses an arithmetic overlay to assign the hexadecimal value 2B to all 32 bits of the symbol A. For more information on arithmetic overlays, see the description of the assignment statement (=). The symbol A has a string value after the overlay because it was previously undefined. (If a symbol is undefined, it has a string value as a result of an arithmetic overlay. If a symbol was previously defined, it retains the same data type after the overlay.) The hexadecimal value 2B corresponds to the ASCII value of the plus sign (+). Next, the F$CVSI function extracts the low-order 4 bits from the symbol A; the low-order 4 bits contain the binary representation of the hexadecimal value B. These bits are converted, as a signed value, to an integer. The converted value, -5, is assigned to the symbol X. 2.$ SYM[0,32] = %X2A $ SHOW SYMBOL SYM SYM = "*..." $ Y = F$CVSI(0,33,SYM) %DCL-W-INVRANGE, field specification is out of bounds - check sign and size $ SHOW SYMBOL Y %DCL-W-UNDSYM, undefined symbol - check spelling In this example, the width argument specified with the F$CVSI function is too large. Therefore, DCL issues an error message and the symbol Y is not assigned a value.
|