HLASM Programmer's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Nesting COPY instructions and macro definitions

HLASM Programmer's Guide
SC26-4941-06

The assembler lets you code COPY instructions and macro call instructions in copy code members. It also lets you code COPY instructions in macro definitions. This type of coding is described as nesting.

If the exit is processing a member, and supplies a record to the assembler containing a COPY instruction or a macro call instruction, the assembler calls the exit with a request type of FIND COPY or FIND MACRO. In this case, the exit needs to save the position in the currently active member before reading the new copy code or macro member. This enables the exit to resume processing the currently active member after it finishes with the new member.

The assembler indicates that it is processing a new (or nested) member by setting the options field to 3. When the assembler finishes processing the new member and resumes the previous (or outer) member, it issues a FIND call to the exit with the options field set to 2 indicating that the previous member is resumed. After the FIND call is complete, the assembler continues with PROCESS or READ calls to the exit for the previous member.

When the assembler calls the exit with a FIND COPY or FIND MACRO request, and the options field is set to 3, the exit should save the current member control information in a stack.

When the assembler calls the exit with a FIND COPY or FIND MACRO request, and the options field is set to 2, the exit should restore the previous member control information from the stack. The next READ request expects the next record from the previous member.

The assembler does not limit the number of levels of nesting.

There is a corresponding FIND (resume) request for every successful nested FIND request, except under the following situations:
  • An END instruction is found while reading a copy code member. The END instruction causes the assembly to stop.
  • When the assembler issues a PROCESS call, and provides the last record in a copy code member, and the record is a macro call. In this case there are no more copy records to resume reading.
  • When a macro call (outer macro) inside a copy code member in turn issues a macro call (inner macro). In this case, the assembler processes the outer macro to completion, and then begins to generate the outer macro. During generation, the assembler begins to process the inner macro, without issuing a FIND (resume) request for the outer macro or copy code member. The assembler issues a FIND request for each nested macro call, with options set to 3. It does not issue a FIND request for the outer macro, with options set to 2, because the outer macro processing is complete.
  • An error occurs during the assembly that prevents the member from being read completely.

If the FIND COPY or FIND MACRO is unsuccessful, the position in the currently active member should not be affected.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014