CL Command Reference - CPYTOIMPF

CL Command List > CPYTOIMPF Reference

Description:

The Copy To Import File (CPYTOIMPF) command copies an externally-described file to an import file. The term import file is used to describe a file created for purposes of copying data between heterogeneous databases. The import file (TOSTMF or TOFILE parameter) will be called the to-file for this command.

Some of the specific functions that can be performed by the CPYTOIMPF command include the following:
. Copying from an externally described physical file to the to-file (TOFILE or TOSTMF parameter).
. Adding records to an existing to-file member or replacing the contents of the to-file member (MBROPT parameter).

Error Handling: The escape message CPF2817 is sent for many different error conditions that can occur during a copy operation. At least one diagnostic message that indicates the specific error condition always comes before the escape message.

Overrides: All overrides are in effect for this command. The parameters of the overrides that are supported by CPYTOIMPF are:
. FILE
. MBR
. OPNSCOPE
. SHARE
. LVLCHECK
. RCDFMTLCK
. SEQONLY
. INHWRT
. WAITRCD
. DSTDTA
. NBRRCDS
. STMFCODPAG

Status Message: During the running of the CPYTOIMPF command, message CPI2801 is sent as a status message informing the interactive user that a copy is occurring.

Restrictions:

. During the time a CPYTOIMPF request is run, the file specified for the To data base file (TOFILE) parameter may be locked (similar to an *EXCL lock with no timeout) so that no access is possible.

. If the from-file has the SHARE(*YES) attribute, unpredictable results can occur. Therefore, if the from-file is defined with SHARE(*YES), the user should make sure the file is not opened by any process prior to the copy.


Examples:

CPYTOIMPF FROMFILE(DB2FILE) TOFILE(EXPFILE)
FLDDLM(¡¯;¡¯) RCDDLM(X¡¯07¡¯)
STRDLM(*DBLQUOTE) DATFMT(*JIS) TIMFMT(*JIS)

All records of externally described file DB2FILE will be copied to import file EXPFILE. Fields in the import file will be delimited by semi-colon (;) characters. Each record in the import file will be delimited by a hexadecimal ¡¯07¡¯ character. Character, date, time, and timestamp values will begin and end with the double quote character. Date and time fields will be in the *JIS format.