How the copy function adds members to the to-file

 

The copy function adds a member to the to-file when the member does not exist. The member name used is either the TOMBR parameter value from the copy command, or the member name that is specified in an override for the to-file.

If TOMBR(*FROMMBR) or TOMBR(*FROMLABEL) is specified on the copy command (and is not overridden), the from-file member names or label identifiers are used for the members added to the file. If TOMBR(*FIRST) is specified on the copy command, or if there is an override that specifies a TOFILE parameter with no MBR parameter, then no member name is known. The copy function does not add a member in this case unless the following conditions are true:

Except for the CPYFRMQRYF command, when the copy function creates the to-file without a specific member name specified, the from-file name is used for the member that is added to the to-file. When using the CPYFRMQRYF command, the member added to the physical file that is created by the copy operation has the name specified by the TOMBR parameter. If you specify TOMBR(*FIRST), the to-file member has the same name as the to-file file name that is specified on the TOFILE parameter of the CPYFRMQRYF command. The copy command ignores the MBROPT parameter value when it creates the to-file, and adds records to the new file members.

If the from-file is a database file, the copy command uses the member text and SEU source type of the from-file member for the member that is added to the to-file. If the from-file is a device or inline data file, the copy command takes the text from message CPX0411; the SEU source type is TXT. If both the from-file and to-file are database source files, the SEU source type information in the added member will be the same as the from-file member. When it adds the to-file member, the copy command always assigns the SHARE(*NO) and EXPDATE(*NONE) attributes to the to-file member. The copy command also sets the creation date of the new member to the current system date (not the date when the from-file member was added).

When the copy command adds a member to a to-file that is a parent file, the constraint becomes established at that time.

 

Parent topic:

Selecting members to copy