Copycode

This document describes the advantages and the use of copycode.

The following topics are covered:


Use of Copycode

An object of type copycode contains a portion of source code which can be included in another object via an INCLUDE statement.

So, if you have a statement block which is to appear in identical form in several objects, you may use a copycode object instead of coding the statement block several times. This reduces the coding effort and also ensures that the blocks are really identical.

Processing of Copycode

The copycode is included at compilation; that is, the source-code lines from the copycode are not physically inserted into the object that contains the INCLUDE statement, but they will be included in the compilation process and are thus part of the resulting cataloged object.

Consequently, when you modify the source code of copycode, you also have to catalog all objects which use that copycode.

Attention:

  • Copycode cannot be executed on its own. It cannot be stowed, but only saved.

  • An END statement must not be placed within a copycode.

For further information, refer to the description of the INCLUDE statement (in the Statements documentation).