Copying Members That Have Alias Names (COPY Statement)
This topic discusses using the COPY statement for copying a PDS, PDSU, or PDSE that has members with alias names. The COPYGRP or COPYGROUP statement is recommended for copying program objects.
Tip: If the COPY statement is used to copy program objects, errors can occur.
- If you are copying an entire data set to a new data set (one that has no members before the copy operation), all members and their aliases will be copied, and they will have the same relationship to one another as they had on the original data set.
- If you are merging a data set with another data set, no members
or aliases on the output data set will be changed unless you specify
that input members are to replace output members.
Example:
- In all instances, if you have a member A with alias B on your input data set, and a member C with alias B on your output data set, if you do not indicate replacement, member A will be copied over, but the alias name B will continue to refer to C. If you do indicate replacement, B will be copied as an alias of member A in the newly merged data set.
- When selectively copying from a partitioned data set, you must
specify every name that you want copied, including their aliases.
Example:
- If you are selecting member A, and member A has the aliases B and C, to copy all three names you must specify SELECT MEMBER=(A,B,C). This will result in one copy of the data for that member, and all three names placed in the directory and associated with that member data.
- If you specify SELECT MEMBER=(A,C). This will result in one copy of the data for that member, and two names, A and C, placed in the directory and associated with that member data.
- When copying to or from a PDSE, you must specify the member's name. An alias will not become the member name in the output data set.
- If you are exclusively copying a data set (using the EXCLUDE statement),
you must specify not only a member's name, but also all of its alias
names to exclude the member data from the copy operation.
Example:
- If you want to exclude member A from the copy operation, and A has the alias names B and C, you must specify EXCLUDE MEMBER=(A,B,C). If you specify only MEMBER=A, then the member is copied to the output data set with the alias names B and C.
- The rules for replacing or renaming members apply to both aliases and members; no distinction is made between them.
Related reading: For information about copying program objects, see Copying Program Objects (COPYGRP and COPYGROUP Statements).