COPY Statement

The HP COBOL syntax of the COPY statement is:

COPY source-file [ {OF} library-name ] [ NOLIST ]
                   {IN}

   [ REPLACING  { { old-text } BY { new-text } } ... ].

If the "-Cp" option is specified, ACUCOBOL-GT supports the HP COBOL variant of the COPY statement that copies a file from a resident library. In this usage, library-name is a one to eight character alphanumeric name that specifies the resident library in which the source file is located. This library is a KSAM or text file that contains one or more source files.

If library-name is not specified, the compiler assumes that the library name is COPYLIB. If source-file cannot be found in the library, then ACUCOBOL-GT checks to see if source-file is in the current directory.

Note: HP COBOL assumes the name of the source file is in uppercase. If an uppercase name is not found in the current directory, the rules that ACUCOBOL-GT uses for source-file and library-name will be used (described below).

If the "-Cp" option is not specified, the standard rules that ACUCOBOL-GT applies to source-file and library-name are used. This means that library-name is interpreted as a directory name. If you have a resident library, you will need to unload its contents. In the working directory in which you perform compilations, create a subdirectory of the same name and case as library-name. Unload the library's source files into this subdirectory using the same name and case as specified by source-file. The next time you compile, ACUCOBOL-GT will find source-file in the directory you created. For example, if your COBOL COPY statement reads:

COPY support IN common

During compilation, ACUCOBOL-GT will translate that statement into:

COPY "./common/support"

If library-name is not specified, ACUCOBOL-GT checks to see if source-file is in the current directory. If source-file is not found in the current directory, the rules that ACUCOBOL-GT uses for finding source-file are applied. (For more information about ACUCOBOL-GT's treatment of the COPY statement and the use of the COPYPATH environment variable for locating copy files, see COPY Libraries.

NOLIST is supported by ACUCOBOL-GT in HP COBOL compatibility mode. NOLIST has the same meaning as SUPPRESS in ACUCOBOL-GT's default mode. For details, see COPY Statement.

old-text and new-text have the same meaning in HP COBOL as in ACUCOBOL-GT. For details, see COPY Statement.

Note: COPY REPLACING within nested Copy books is not supported.