Copy member search order
This topic discusses the search order of copy
members when a COPY
statement is processed.
When the compiler is invoked from JCL or any
method other than from z/OS® UNIX, the search for a copy member
is performed according to the following rules:
- If an explicit library name is specified in the
COPY
statement, the name is assumed to correspond to a ddname that has been allocated to a concatenation of datasets where the compiler will search for the copy member. If no library name is specified in theCOPY
statement, the concatenation of datasets allocated to theSYSLIB
ddname is searched. - If the copy member was not found during the above search, then
all locations specified via the
COPYLOC
option will be searched in the order that they were specified. These locations can include a mix of z/OS UNIX directories andPDS
orPDSE
datasets.
cob2
command,
the search for a copy member is performed according to the following
rules:- If an explicit library name is specified in the
COPY
statement and the name is a literal, the name will be interpreted as a z/OS UNIX directory and that directory will be searched. - If an explicit library name is specified in the
COPY
statement and it is not a literal, the name is interpreted to be an environment variable that specifies a colon-separated list of z/OS UNIX directories. If the environment variable exists, those z/OS UNIX directories will be searched in the order they appear in the list. If the environment variable does not exist, the current directory will be searched. - If an explicit library name was not specified in the
COPY
statement, the compiler searches for copy members in this order:- The current z/OS UNIX directory is searched for the copy member.
- Any z/OS UNIX directories specified via the
-I
option ofcob2
are searched. - Any z/OS UNIX directories specified via the
SYSLIB
environment variable are searched.
- If the copy member was not found during the above search; then
all locations specified via the
COPYLOC
option are searched in the order that they were specified. These locations can include a mix of z/OS UNIX directories andPDS
orPDSE
datasets.
Note: When the compiler searches for a copy member in a z/OS UNIX directory
and the copy member name in the corresponding COPY statement is not
a literal and is not found to be referring to an environment variable,
then the compiler searches for multiple different versions of the
provided name with the following extensions:
.cpy
, .CPY
, .cbl
, .CBL
, .cob
,
and .COB
.