Copying physical or logical files

 

To copy a physical or logical file (the from-file) on the i5/OS® operating system into another physical file (the to-file) that does not yet exist, you can use the Copy File (CPYF) command. Here is an example:

    CPYF   FROMFILE(PERSONNEL/PAYROLL) 
       TOFILE(TESTPAY/PAYROLL)  MBROPT(*ADD) 
       CRTFILE(*YES)  ERRLVL(10) 

 

Full-service copy support

A variety of copy commands that are modified by numerous parameters give you a great deal of flexibility in the way you copy your data. For instance, you typically can copy your data into existing files (or to-files). As shown in the example above, you can use the CRTFILE parameter on the CPYF or CPYFRMQRYF commands to create the to-file during the copy operation. See Creating the to-file (CRTFILE parameter) for details.

See Copying files: Overview to learn about the basic functions relating to the i5/OS copy commands.

 

Copying only the information you need

The copy function lets you specify selected records and members of your files:

 

Copying across different formats and systems

 

Making the copy function work for your particular needs

You can accomplish a wide variety of tasks with careful use of the options that are available to you through the copy function.

 

Parent topic:

Copying files

 

Related concepts


Copying files: Overview
Creating the to-file (CRTFILE parameter)
Selecting members to copy
Adding, replacing, and updating records (MBROPT parameter)
Selecting the records to copy

 

Related information


CPYF command
CPYFRMQRYF command