Previous Page | Next Page

Scopes of Macro Variables

How Macro Variables Are Assigned and Resolved

Before the macro processor creates a variable, assigns a value to a variable, or resolves a variable, it searches the symbol tables to determine whether the variable already exists. The search begins with the most local scope and, if necessary, moves outward to the global scope. The request to assign or resolve a variable comes from a macro variable reference in open code (outside a macro) or within a macro.

The following figure illustrates the search order the macro processor uses when it receives a macro variable reference that requests a variable be created or assigned. The figure below illustrates the process for resolving macro variable references. Both these figures represent the most basic type of search and do not apply in special cases, such as when a %LOCAL statement is used or the variable is created by CALL SYMPUT.

Search Order When Assigning or Creating Macro Variables

[Search Order When Assigning or Creating Macro Variables]

Search Order When Resolving Macro Variable References

[Search Order When Resolving Macro Variable References]

Previous Page | Next Page | Top of Page