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.

The library containing the to-file<br />

WRKOBJLCK<br />

WRKRCDLCK<br />

If you want to display any information about a to-file, you must anticipate the<br />

requirement and force the copy command to use block record-at-a-time operations<br />

by specifying ERRLVL(1).<br />

If you anticipate that problems may arise because of this, you can preallocate the<br />

files and members using the Allocate Object (ALCOBJ) command. (See the CL<br />

Programming book for information about preallocating objects.)<br />

Preventing copy errors that result from constraint<br />

relationships<br />

A constraint relationship is a mechanism to ensure data integrity between a<br />

dependent file and a parent file. A constraint relationship exists between a<br />

dependent file and a parent file when every non-null foreign key value in the<br />

foreign key access path of the dependent file matches a parent key value in the<br />

parent key access path of the parent file. A physical data file may be a parent or<br />

dependent file. However, a source physical file may not be a parent or a dependent<br />

file.<br />

The copy commands listed below allow the following relationships:<br />

v CPYF - from-file or to-file could be a parent or dependent file<br />

v CPYFRMQRYF - to-file could be a parent or dependent file<br />

v CPYFRMTAP - to-file could be a parent or dependent file<br />

v CPYTOTAP - from-file could be a parent or dependent file<br />

v CPYFRMDKT - to-file could be a parent or dependent file<br />

v CPYTODKT - from-file could be a parent or dependent file<br />

See the following topics for more information about constraint relationships and<br />

copying files:<br />

v “Copying files not in check-pending status”<br />

v “Copying files in check pending status” on page 128<br />

Copying files not in check-pending status<br />

If the parent or dependent file has an established constraint relationship that is not<br />

in check-pending status, the following rules apply:<br />

v If the from-file has an established constraint relationship, then you can copy all<br />

of the records from it whether it is a parent or dependent file.<br />

v If the to-file has an established or enabled constraint relationship, then the<br />

following rules apply to keep the constraint relationship from entering<br />

check-pending status:<br />

– A parent file cannot have its member cleared of records.<br />

– A parent file cannot have more than one parent key value in the parent key<br />

access path of the same value (key must remain unique). That is, if the to-file<br />

is a parent file in a constraint relationship, then the copy does not allow<br />

duplicate key records to be copied into it.<br />

Chapter 4. Copying files 127

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

Saved successfully!

Ooh no, something went wrong!