^DEFINED

Determine if a field, parameter, or macro has been defined

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
^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 or a macro 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.

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