Creating the to-file (CRTFILE parameter)
To copy a physical or logical file when no to-file exists to receive the data, you can create the to-file by specifying CRTFILE(*YES).
In such cases, you specify the name of the new to-file on the TOFILE parameter, and qualify the name with the name of an existing library for which you have the required authority. (You must also have authority to the Create Physical File (CRTPF) command). You cannot override the created to-file that you specified to a different file or library.
CRTFILE(*YES) automatically adds members and records to the new file.
The newly created file has certain authorities, capabilities, and a user profile associated with it. Your system specifies different identifiers and attributes to the new file based on whether you use the Copy File (CPYF) or Copy From Query File (CPYFRMQRYF) command.
- Specifying CRTFILE(*YES) on either the CPYF or CPYFRMQRYF command
You get different results while specifying CRTFILE(*YES) on the Copy File (CPYF) command and the Copy From Query File (CPYFRMQRYF) command.
- Authorities, user profiles, and file capabilities of the to-file
When the Copy File (CPYF) command creates the local physical file, the from-file gives the created to-file all the authorities of the from-file. These authorities include public, private, and authorization lists.
Parent topic:
Copying files
Related concepts
Copying physical or logical files
Authorities, user profiles, and file capabilities of the to-file
Specifying CRTFILE(*YES) on either the CPYF or CPYFRMQRYF command