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.

76 <strong>File</strong> <strong>Management</strong> V4R5<br />

Copying files: basic functions<br />

As indicated in Table 10 on page 74 and Table 11 on page 75, you can copy from a<br />

physical or logical database file, open query file, diskette file, tape file, or inline<br />

data file. The to-file can be a physical database file, diskette file, tape file,<br />

program-described printer file, or *PRINT. When you specify TOFILE(*PRINT), the<br />

CPYSRCF command uses a different format from the other copy commands. This<br />

format shows source information in a more readable format, and for multiple<br />

member copies the members are copied and listed in alphabetical order.<br />

If you are copying from a database file and the to-file does not exist, you must<br />

specify CRTFILE(*YES) and identify the file name and library name on the TOFILE<br />

parameter in order to create the to-file. You cannot copy from a diskette to a<br />

diskette unless the to-file is spooled and a diskette spooling writer is not active.<br />

The from-file (not including the CPYFRMQRYF command where the from-file is<br />

not opened), to-file, and the QSYSPRT printer file (if TOFILE(*PRINT),<br />

PRINT(*COPIED), PRINT(*EXCLD), or PRINT(*ERROR) is specified) are opened<br />

with the SHARE(*NO) attribute. Because the copy may not function correctly with<br />

a shared file, it will end with an error message if the from-file, to-file, or QSYSPRT<br />

printer file is overridden to SHARE(*YES) and the file has already been opened in<br />

the job.<br />

If you specify TOFILE(*PRINT), the records are copied to the <strong>IBM</strong>-supplied printer<br />

file QSYSPRT, and the OUTFMT parameter formats the list.<br />

If you do not want a formatted list or if you want to use first-character forms<br />

control (CTLCHAR(*FCFC) on the Create Printer <strong>File</strong> (CRTPRTF) or Override with<br />

Printer <strong>File</strong> (OVRPRTF) command), you should specify a program-described<br />

printer file name (such as QSYSPRT) instead of *PRINT on the TOFILE parameter.<br />

<strong>File</strong> types and copying<br />

When the from-file and to-file are different types (source and data), the following<br />

is true. For the CPYFRMQRYF command, the from-file is always treated as a data<br />

file:<br />

v If the from-file or to-file is a device file (or an inline data file), the copy function<br />

will automatically add or delete the source sequence number and date fields for<br />

each record copied.<br />

v If the from-file and to-file are database files, you must specify<br />

FMTOPT(*CVTSRC) to perform the operation. The sequence number and date<br />

fields are added or deleted as they are for a device file, and the data part of each<br />

record is copied without regard to the field definitions in the file record formats.<br />

For a source physical to-file, you can use the SRCSEQ parameter to control how<br />

sequence numbers are created if you also specified SRCOPT(*SEQNBR).<br />

Record sequence and copying<br />

The access path is the sequence in which records are organized in a database file.<br />

There are two types of access paths: keyed sequence and arrival sequence. With<br />

the copy function, you can process records in a database file in either arrival<br />

sequence or keyed sequence. An arrival sequence copy transfers records in the<br />

order in which they physically exist in the from-file. Relative record numbers<br />

represent this order. The relative record number is the position where the records

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

Saved successfully!

Ooh no, something went wrong!