30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4. Copying files<br />

You can use the copy function to move data between device files, database files, or<br />

both device and database files with the AS/400 field-level sensitive copy function.<br />

This function allows you to rearrange, enlarge, or drop any of the fields. You can<br />

also define database files.<br />

Copying physical or logical files<br />

To copy a physical or logical file (the from-file) on AS/400 into another physical file<br />

(the to-file), which does not yet exist, you can use the CPYF command, as in the<br />

following example:<br />

CPYF FROMFILE(PERSONNEL/PAYROLL)<br />

TOFILE(TESTPAY/PAYROLL) MBROPT(*ADD)<br />

CRTFILE(*YES) ERRLVL(10)<br />

Full service copy support:<br />

A variety of copy commands that are modified by numerous parameters gives you<br />

a great deal of flexibility in the way you copy your data. For instance, you usually<br />

can copy your data into existing files (or to-files). As shown in the example above,<br />

you can use the CRTFILE parameter on the CPYF or CPYFRMQRYF commands to<br />

create the to-file during the copy operation. See “Creating the to-file (CRTFILE<br />

parameter)” on page 82 for details.<br />

See “Copying files: overview” on page 70 to learn about the basic functions relating<br />

to the AS/400 copy commands.<br />

Copy only the information you need:<br />

The copy function lets you specify selected records and members of your files:<br />

v “Adding, replacing, and updating records (MBROPT parameter)” on page 84<br />

v “Selecting members to copy” on page 88<br />

v “Selecting the records to copy” on page 92<br />

Copy across different formats and systems:<br />

v “Copying between different database record formats (FMTOPT parameter)” on<br />

page 106. You can copy from a source file to a data file or from a data file to a<br />

source file. If the from-file or to-file is a device file, this function is automatic. If<br />

both files are database files, you must specify FMTOPT(CVTSRC). If either file is<br />

a device file or inline data file, the FMTOPT parameter does not apply.<br />

v “Copying between different systems” on page 139. This is especially important<br />

for when you are using Data Warehousing, and when you want to use existing<br />

export products from other platforms to move data to the AS/400.<br />

Make the copy function work for your particular needs:<br />

You can accomplish a wide variety of tasks with careful use of the options that are<br />

available to you through the copy function.<br />

© Copyright <strong>IBM</strong> Corp. 1998, 2000 69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!