HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Where to define a macro in a source module

HLASM Language Reference
SC26-4940-06

Macro definitions can appear anywhere in a source module. They remain in effect for the rest of your source module, or until another macro definition defining a macro with the same operation code is encountered, or until an OPSYN statement deletes its definition. Thus, you can redefine a macro at any point in your program. The new definition is used for all subsequent calls to the macro in the program.

This type of macro definition is called a source macro definition, or, sometimes, an in-line macro definition. A macro definition can also reside in a system library; this type of macro is called a library macro definition. Either type can be called from the source module by the applicable macro instruction.

Macro definitions can also appear inside other macro definitions. There is no limit to the levels of macro definitions permitted.

The assembler does not process inner macro definitions until it finds the definition during the processing of a macro instruction calling the outer macro. The following example shows an inner macro definition:

Example:
         MACRO                               Macro header for outer macro
         OUTER           &A,&C=              Macro prototype
         AIF             ('&C' EQ '').A
         MACRO                               Macro header for inner macro
         INNER                               Macro prototype
         .
         .
         MEND                                Macro trailer for inner macro
.A       ANOP
         .
         MEND                                Macro trailer for outer macro

The assembler does not process the macro definition for INNER until OUTER is called with a value for &C other than a null string.

Open Code: Open code is that part of a source module that lies outside of any source macro definition. At coding time, it is important to distinguish between source statements that lie in open code, and those that lie inside macro definitions.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014