


The COPY verb accepts the following forms:
COPY library-name [ OF path-name ] [ SUPPRESS ]. COPY RESOURCE resource-name [ OF path-name ].
where library-name and path-name are either user-defined words or alphanumeric literals. Resource-name is an alphanumeric literal.
Environment variables may be used in the path-name--this is indicated by a $ sign before the name of the variable. For example:
COPY library-name OF "$COPYLIB".
You may also use multiple environment variables to define a path:
COPY library-name OF "$LIB/$COPYLIB/$SUBDIR".
Library-name is the file name of the copy library to include in the object library. Resource-name is a file (other than a COBOL object) that is to be included in a COBOL object library. If path-name is specified, then it is treated as a directory specification for library-name or resource-name.
The file name is derived by concatenating path-name with library-name or resource-name, using the appropriate syntax for the host operating system. For example, on a UNIX system,
COPY MYCOPY OF "/usr2/acctdir"
is translated to
COPY "/usr2/acctdir/MYCOPY".
COPY "MYFILE.CPY"
and
COPY MYFILE.CPY
are both allowed and mean exactly the same thing.
When a period is placed in a library name which is a user-defined word used without quotes, it must be preceded and followed by a (non-period) character normally allowed in an identifier (thus ".MYFILE", "MYFILE." and "MYFILE..CPY" are all disallowed).
In addition, the COPY RESOURCE statement allows the resource name to be a user-defined word just like in a Format 1 COPY statement (the resource name does not have to be an alphanumeric literal).
You can modify the search path by setting an operating system variable. On UNIX and MS-DOS systems, you do this by setting the environment variable COPYPATH to be the list of directories to search. For VMS systems, the symbol COPYPATH is set instead.
The COPYPATH variable consists of a series of prefixes to apply to the file name. Each prefix is terminated by a special character that depends on the host operating system.
| System
| Separator
|
| MS-DOS
| Semicolon
|
| Windows
| Semicolon
|
| OS/2
| Semicolon
|
| UNIX
| Colon
|
| MPE/iX
| Colon
|
| VMS
| Comma |
:/u/pr:/u/ap:
The initial colon indicates an empty prefix (i.e., the current directory). Note that the "-Sp" compiler option can also be used to specify the search path for COPY libraries. If used, it takes precedence over the COPYPATH setting.
You may use the word SUPPRESS to exclude the contents of a library file or any library files nested within from the program listing. For example:
COPY MYFILE OF "$MYLIB" SUPPRESS.
COPY statements may contain other COPY statements. This nesting is limited by the total number of files that the operating system will allow a program to open at once.
More: