Copying files
With the copy function on the i5/OS® operating system, you can copy physical and logical files, copy members and records, copy complex objects, and copy files between systems.
You can move data between device files, database files, or both device and database files with the i5/OS field-level-sensitive copy function. This function allows you to rearrange, enlarge, or drop any of the fields. You can also define database files.
- Copying files: Overview
You can use the copy function to move data between device files, between database files (including distributed DB2® Multisystem files), or between device and database files.
- 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.
- 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).
- Adding, replacing, and updating records (MBROPT parameter)
Many i5/OS copy commands enable you to add or replace existing data in the to-file specifying different attributes on the MBROPT parameter.
- Selecting the records to copy
You can use parameters on the copy commands to select only the specific records that you want to copy.
- Printing records (PRINT, OUTFMT, and TOFILE(*PRINT) parameters)
By specifying PRINT special values on a copy command, you can print a list of all records copied, all records excluded, or all records causing ERRLVL output errors.
- Selecting members to copy
The system gives you several options for copying file members.
- Copying between different database record formats (FMTOPT parameter)
When you copy from a database file to a database file, use the FMTOPT parameter if the record formats are not identical or if the files are different types (source or data). If either file is a device file or inline data file, the FMTOPT parameter does not apply. The records are truncated or padded with blanks or zeros when record lengths are different. A message is sent if the records are truncated.
- Adding or changing source file sequence number and date fields (SRCOPT and SRCSEQ parameters)
You can perform additions or changes to sequence number fields and date fields sequence number and date fields when you are copying files.
- Copying complex objects
You can copy from and to files that contain user-defined functions (UDFs), user-defined types (UDTs), DataLinks (DLs), large objects (LOBs), identity columns, or ROWIDs.
- Copying between different systems
You can use the Copy From Import File (CPYFRMIMPF) and Copy To Import File (CPYTOIMPF) commands discussed in this topic to import (load) or export (unload) data to and from the System i™ platform.
Parent topic:
Working with database files
Related concepts
File types