Domain: Variable access (variable name)
The CURRENT-TYPE( ) function returns the current type of the value of a simple variable (this must not be confused with the current type of a variable declaration, which is returned by the VARIABLE-ATTRIBUTE( ) function). If the variable type has not yet been defined (TYPE = *ANY), or if CURRENT-TYPE( ) is applied to a complex variable, *NONE is returned as the result.
Format
CURRENT-TYPE( ) CURR-TYPE( ) |
VARIABLE-NAME = string_expression |
Result type
STRING
Input parameters
VARIABLE-NAME = string_expression
Designates the variable whose type is requested. The variable name must be enclosed in apostrophes if it is specified directly, i.e. as a literal (see also the example on the next page and the last example in the description of IS-DECLARED( )).
Result
*BOOLEAN
“string_expression” designates a variable which contains a value of the type BOOLEAN (the variable must have been declared with the type BOOLEAN or *ANY).
*INTEGER
“string_expression” designates a variable which contains a value of the type INTEGER (the variable must have been declared with the type INTEGER or *ANY).
*NONE
The variable “string_expression” does not yet have a defined variable type, or “string_expression” designates a complex variable.
*STRING
“string_expression” designates a variable which contains a value of the type STRING (the variable must have been declared with the type STRING or *ANY).
Error messages
SDP1007 NO VARIABLE DECLARED SDP1101 SYNTAX ERROR IN VARIABLE NAME
Example
/DECLARE-VARIABLE A (TYPE = *ANY) /B = CURRENT-TYPE(VARIABLE-NAME = 'A') /SHOW-VAR B B = *NONE /A = 123 /B = CURRENT-TYPE(VARIABLE-NAME = 'A') /SHOW-VAR B B = *INTEGER