%INTEGER
Convert an expression to an integer value
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
integer = %INTEGER(expression[, magnitude])
Return value
integer
The integer value of expression. (i)
Arguments
expression
The expression to convert to an integer value. (a or n)
magnitude
(optional) The size of the result. (n)
Discussion
%INTEGER converts an expression to an integer value.
Expression is converted according to the rules for moving data to an integer destination. (See Assignment statements for a description of these rules.) If the converted expression is too long to fit into the requested integer size, the high-order bits that don’t fit are ignored. If magnitude is not specified or contains a value other than 1, 2, 4, or 8, the resulting string is four bytes long.
Examples
This example uses alpha input as data for an integer arithmetic computation. If the alpha variable contains any nonnumeric data other than a blank, a decimal point, or a sign (+ or –), a “Bad digit encountered” error ($ERR_DIGIT) is generated.
subroutine math a_avar ,a record val1 ,i2 val2 ,i2 result ,i4 proc result = (val1*val2)/%integer(a_avar) . . . return endsubroutine