Eliminating repetitive coding

To include stored source statements in a program, use the COPY statement in any program division and at any code sequence level. You can nest COPY statements to any depth.

About this task

To specify more than one copy library, either set the environment variable SYSLIB to multiple path names separated by a colon (:), or define your own environment variables and include the following phrase in the COPY statement:


IN/OF library-name

For example:


COPY MEMBER1 OF COPYLIB

If you omit this qualifying phrase, the default is SYSLIB.

COPY and debugging line: In order for the text copied to be treated as debug lines, for example, as if there were a D inserted in column 7, put the D on the first line of the COPY statement. A COPY statement cannot itself be a debugging line; if it contains a D, and WITH DEBUGGING mode is not specified, the COPY statement is nevertheless processed.

Example: using the COPY statement

Related references  
Compiler-directing statements