Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Returns the existence status of variables and their dimensioned array subnodes.
varname Name of a variable to test for existence, and/or the presence of dimensioned array subnodes.
The EXISTS function returns an integer code indicating whether a variable is defined (1) or not defined (0). It can also indicate that the specified variable is not defined, but that the variable has defined subscripts. The varname parameter can be the name of any variable (local variable, process-private global, or global), and can include a subscript (an array element).
EXISTS returns an integer code indicating that the specified variable is:
Similar information can be returned using the $DATA function.
EXISTS should not be used on system variables (@ variables). It always returns 0 for all @ variables, whether or not the @ variable currently has a value.
The following example shows the four possible EXISTS return values. The specified variables are all process-private globals:
PRINT EXISTS(^||a); ! returns 1
PRINT EXISTS(^||b); ! returns 2
PRINT EXISTS(^||c); ! returns 3
PRINT EXISTS(^||z); ! returns 0
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA