To copy a physical or logical file (the from-file) on iSeries™ into another physical file (the to-file),
which does not yet exist, you can use the CPYF command.
Below 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 gives 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 Create the to-file (CRTFILE parameter) for
details.
See Copy files: overview to
learn about the basic functions relating to the iSeries copy
commands.
Copy only the information you need
The copy function
lets you specify selected records and members of your files:
Copy across different formats and servers
- Copying between different database record formats (FMTOPT parameter). You can
copy from a source file to a data file or from a data file to a source file.
If the from-file or to-file is a device file, this function is automatic.
If both files are database files, you must specify FMTOPT(CVTSRC). If either
file is a device file or inline data file, the FMTOPT parameter does not apply.
- Copy between different servers. This is especially
important for when you are using Data Warehousing, and when you want to use
existing export products from other platforms to move data to the iSeries server.
Make 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.