Loading...
Select Version
&pagelevel(3)&pagelevel
Domain: Conversion functions
The INTEGER( ) function converts any expression to the data type INTEGER. In doing this, STRING expressions are converted according to the rules of implicit conversion. The following applies to BOOLEAN expressions: TRUE is converted to the value 1, FALSE to 0.
The IS-INTEGER function can be used to first check whether a STRING expression can be converted.
Format
INTEGER( ) INT( ) |
EXPRESSION = expression |
Result type
INTEGER
Input parameters
EXPRESSION = expression
“expression” is a STRING, INTEGER or BOOLEAN expression.
Result
Number of type INTEGER
Error message
SDP0415 SYNTAX ERROR: INTEGER EXPECTED IN STRING. CONVERSION NOT POSSIBLE
Example
The variables A, B, C and D are initialized:
/A = '4' /B = 5 /C = 30 /D = TRUE “Type: BOOLEAN” /AINT = INTEGER(EXPRESSION = A) /SHOW-VARIABLE AINT AINT = 4 BINT = INTEGER(EXPRESSION = B + C) /SHOW-VARIABLE BINT BINT = 35 /CINT = INTEGER(EXPRESSION = D) /SHOW-VARIABLE CINT CINT = 1