Copy files that contain DataLinks

You can specify CRTFILE(*YES) on the CPYF and CPYFRMQRYF commands when you copy files that contain DataLinks (DLs). If the from-file is an SQL table, view, or index that contains a DL, these commands create an SQL table.

You cannot copy DDM files that contain DataLinks to iSeries™ servers running at Version 4 Release 3 or earlier.

DLs can be mapped only to other DLs. Therefore, if you specify *NONE, *MAP, or *DROP on the FMTOPT parameter, the from-file and to-file must have corresponding DLs. Truncation is not allowed. Shorter DLs, however, can be converted to longer DLs.

A file can be linked only once on a server. Therefore, a copy that will perform mapping or that requires the formats to be identical (that is, *NONE, *MAP, or *DROP is specified on the FMTOPT parameter) will not be successful if corresponding from-file and to-file fields are both FILE LINK CONTROL. Copies that are performed using the *NOCHK parameter option are not restricted, but errors will occur if a DL that references a linked file is copied to a DL that is FILE LINK CONTROL.

When you specify CRTFILE(*YES) on the CPYF or CPYFRMQRYF command, and the from-file contains a FILE LINK CONTROL DL field, the following statements are true, depending on how you specify the FMTOPT parameter:
The following table shows LINK scenarios associated with the CPYF command when different FMTOPT values are used.
LINK status for from-field to to-field when FMTOPT parameter is *MAP or *NONE How linking is performed
FILE LINK CONTROL to FILE LINK CONTROL Not allowed. Files can be linked only once.
NO LINK CONTROL to FILE LINK CONTROL (with no truncation) Linking is performed.
FILE LINK CONTROL to NO LINK CONTROL (with no truncation) No linking is performed.
NO LINK CONTROL to NO LINK CONTROL (with no truncation) No linking is performed.
Related information
CPYF command
CPYFRMQRYF command