You can use the DEFINED operator to see whether a symbol is defined or not. Typically, this is used with conditional directives to control whether a portion of a file is assembled or not.

Syntax

DEFINED symbol

The DEFINED operator returns a Boolean result which is true of the symbol is define at that point in the file, and false otherwise. Note that this operator only inquires whether the symbol is known to the assembler, not whether it has a known value: imported symbols are considered as defined even though the assembler does not know their value.

DEFINED cannot be used to detect whether a macro has been defined.

Example

The following show how defined works in a number of cases.

        .IMPORT X
Y       EQU    10
B1      EQU    DEFINED X   ; true (1)
B2      EQU    DEFINED Y   ; true (1)
B3      EQU    DEFINED Z   ; false (0) -- not defined yet
B4      EQU    DEFINED U   ; false (0) -- never defined
Z       EQU    100