Domain: Variable access/test functions
The IS-INITIALIZED( ) function checks whether the specified variable is initialized, i.e. whether its content is valid. Even the null string is a valid variable content.
Only simple variables or list variables can be checked.
Format
IS-INITIALIZED( ) |
VARIABLE-NAME = string_expression |
Result type
BOOLEAN
Input parameters
VARNAME = string_expression
Designates a simple variable or list variable. The variable name must be enclosed in apostrophes if it is specified directly, i.e. as a literal (see the example below and the example in the description of IS-DECLARED( )).
A list variable must be specified as ’listname#’. Individual list elements can be specified as ’listname#elementindex’.
Result
TRUE
The variable designated by the VARIABLE-NAME parameter is initialized.
FALSE
The variable designated by the VARIABLE-NAME parameter is not initialized.
Error message
SDP1101 SYNTAX ERROR IN VARIABLE NAME
Example
/DECLARE-VARIABLE X /DECLARE-VARIABLE A /A = 'ABC' /B = IS-INITIALIZED(VARIABLE-NAME = 'A') /SHOW-VARIABLE B B = TRUE /B = IS-INITIALIZED(VARIABLE-NAME = 'AA') /SHOW-VARIABLE B B = FALSE /B = IS-INITIALIZED(VARIABLE-NAME = 'X') /SHOW-VARIABLE B B = FALSE /FREE-VARIABLE(NAME = A) /B = IS-INITIALIZED(VARIABLE-NAME = 'A') /SHOW-VARIABLE B B=FALSE
Since variable A has no content after FREE-VARIABLE, the result FALSE is supplied.