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

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)



A field or path specification. (a or n)


^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.


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.


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