Use the COPY instruction to obtain source statements from a source
language library and include them in the program being assembled.
You can thus avoid writing the same, often-used sequence of code over
and over.
>>-+-----------------+--COPY--member---------------------------><
'-sequence_symbol-'
- sequence_symbol
- Is a sequence symbol.
- member
- Is an ordinary symbol that identifies a source language library
member to be copied from either a system macro library or a user macro
library. In open code, it can also be a variable symbol that has
been assigned a valid ordinary symbol.
The source statements that are copied into a source module:
Notes: - The COPY instruction can also be used to copy statements into
source macro definitions.
- The rules that govern the occurrence of assembler language statements
in a source module also govern the statements copied into the source
module.
- Whenever the assembler processes a COPY statement, whether it
is in open code or in a macro definition, the assembler attempts to
read the source language library member specified in the COPY statement.
This means that all source language library members specified by
COPY statements in a source program, including those specified in
macro definitions, must be available during the assembly. The HLASM Programmer's Guide describes
how to specify the libraries when you run the assembler, in these
sections:
- CMS: "Specifying macro and copy code libraries: SYSLIB"
- z/OS: "Specifying macro and copy code libraries: SYSLIB"
- z/VSE: "Specifying macro and copy code libraries: LIBDEF job
control statement"
- If an END instruction is encountered in a member during COPY processing,
the assembly is ended. Any remaining statements in the COPY member
are discarded.