^DEFINED

Determine if a field or parameter has been defined

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
^DEFINED(variable_spec)

Return value

^DEFINED returns a value of 1 if the entity has been defined, or a value of 0 if the entity has not been defined. (i)

Arguments

variable_spec

A field or path specification. (a or n)

Discussion

^DEFINED is evaluated at compile time. It determines if a field or parameter has been defined.

You don’t need to specify a full path specification for variable_spec as long as you specify enough information to determine that the field exists.

Note

Macros are expanded when ^DEFINED is processed. Therefore, it is not possible to use ^DEFINED to determine whether a macro variable is defined. Instead, use .IFDEF and .IFNDEF for this purpose.

Examples

This example determines whether code is compiled based on whether or not rec.dvar has been defined.

.if .not. ^defined(rec.dvar)
    .                           ;This code will be compiled if rec.dvar 
    .                           ; is not defined
    .
.endc