File Management - IBM

File Management - IBM File Management - IBM

as400bks.rochester.ibm.com
from as400bks.rochester.ibm.com More from this publisher
30.06.2013 Views

Using the Copy From Import File (CPYFRMIMPF) command to copy between different systems The Copy From Import File (CPYFRMIMPF) commandmaps or parses the data from (″import″) an import file to the to-file For more information on the CPYFRMIMPF command, see “Notes on the CPYFRMIMPF command” and “Restrictions on the CPYFRMIMPF command” on page 141. Depending on what type of file the import file is, there are different steps to use when running CPYFRMIMPF. See the following topics for more information on the appropriate steps: v “(CPYFRMIMPF) Importing data to the AS/400 when the from-file is a database file or DDM file” on page 141 v “(CPYFRMIMPF) Importing data to AS/400 when the import file is a stream file” on page 142 The CPYFRMIMPF command also supports a parallel data loader to copy information from an import file to a to-file using multiple jobs during the copy. To use multiple jobs, the system must have the Symmetric Multiprocessing Product (SMP). See “Parallel data loader support to use with the CPYFRMIMPF command” on page 143 for more information on Parallel Data Loader support. Using the Copy To Import File (CPYTOIMPF) command to copy between different systems 140 File Management V4R5 The Copy To Import File (CPYTOIMPF) command copies the data from the from-file to an import file. You can then move the import file (or file to be exported) to your platform by any method you choose, such as TCP/IP file transfer (text transfer), CA/400 support (file transfer, ODBC), or CPYTOTAP (copy to tape file) command. Your system then handles the data from the import file in one of two ways. See “Handling data from the import file” on page 143 for more information. The user can also specify a stream file, and the CPYTOIMPF will copy the data to the stream file. For more information on the CPYTOIMPF command, see “Notes on the CPYTOIMPF command” on page 146. Notes on the CPYFRMIMPF command The authority needed to perform the copy using the CPYFRMIMPF command is similar to the authority requirements for all other copies. The from-file can be any of the following: v A stream file v A DDM file v A tape file v A source physical file v A distributed physical file v A program described physical file v A single format logical file v An externally described physical file with one field. The one field cannot be a numeric data type. The to-file can be any of these:

v A source file v A DDM file v A distributed physical file v A program described physical file v An externally described physical file The field definition file can be any of these: v A source physical file v A DDM file v A program described physical file v An externally described physical file with one field The error file can be any of the following: v A source physical file v A DDM file v A program described physical file v An externally described physical file with one field Note: The format of the error file and from-file must be the same. Restrictions on the CPYFRMIMPF command The following restrictions apply to the CPYFRMIMPF command: v The data type of the from-file can be one of two types: – A source physical file – A physical file with one field with a data type of CHARACTER, IGC OPEN, IGC EITHER, IGC ONLY, GRAPHIC, or variable length v The copied records do not have the same relative record numbers in the to-file as in the from-file. v Create the to-file prior to copying. v The command restricts the correct usage for delimiters. v The to-file and from-file cannot be the same file. – If a record from the from-file cannot be imported, the process continues based on the Errors Allowed (ERRLVL) parameter. – If the from-file is a stream file, a temporary database file is created in QRECOVERY. The naming convention for these types of files is QACPXXXXXX where the system fills in XXXXXX. – If the from-file is a source file, the system does not copy the first 12 bytes of the record (Sequence field and Date field). If the to-file is a source file, the system sets the first 12 bytes of the to-file’s data (Sequence field and Date field) to zeros. You can use this command on files that contain user-defined types (UDTs) and user-defined functions (UDFs). You cannot use this command on files that contain large objects (LOBs) or DataLinks (DLs). (CPYFRMIMPF) Importing data to the AS/400 when the from-file is a database file or DDM file The from-file contains the data you want to import to AS/400. To import data for a database file or DDM file, follow these steps: 1. Create an import file for the data that you can copy to a DB2 for AS/400 externally described file. The import file can be a database source file, an Chapter 4. Copying files 141

v A source file<br />

v A DDM file<br />

v A distributed physical file<br />

v A program described physical file<br />

v An externally described physical file<br />

The field definition file can be any of these:<br />

v A source physical file<br />

v A DDM file<br />

v A program described physical file<br />

v An externally described physical file with one field<br />

The error file can be any of the following:<br />

v A source physical file<br />

v A DDM file<br />

v A program described physical file<br />

v An externally described physical file with one field<br />

Note: The format of the error file and from-file must be the same.<br />

Restrictions on the CPYFRMIMPF command<br />

The following restrictions apply to the CPYFRMIMPF command:<br />

v The data type of the from-file can be one of two types:<br />

– A source physical file<br />

– A physical file with one field with a data type of CHARACTER, IGC OPEN,<br />

IGC EITHER, IGC ONLY, GRAPHIC, or variable length<br />

v The copied records do not have the same relative record numbers in the to-file<br />

as in the from-file.<br />

v Create the to-file prior to copying.<br />

v The command restricts the correct usage for delimiters.<br />

v The to-file and from-file cannot be the same file.<br />

– If a record from the from-file cannot be imported, the process continues based<br />

on the Errors Allowed (ERRLVL) parameter.<br />

– If the from-file is a stream file, a temporary database file is created in<br />

QRECOVERY. The naming convention for these types of files is<br />

QACPXXXXXX where the system fills in XXXXXX.<br />

– If the from-file is a source file, the system does not copy the first 12 bytes of<br />

the record (Sequence field and Date field). If the to-file is a source file, the<br />

system sets the first 12 bytes of the to-file’s data (Sequence field and Date<br />

field) to zeros.<br />

You can use this command on files that contain user-defined types (UDTs) and<br />

user-defined functions (UDFs). You cannot use this command on files that contain<br />

large objects (LOBs) or DataLinks (DLs).<br />

(CPYFRMIMPF) Importing data to the AS/400 when the<br />

from-file is a database file or DDM file<br />

The from-file contains the data you want to import to AS/400. To import data for a<br />

database file or DDM file, follow these steps:<br />

1. Create an import file for the data that you can copy to a DB2 for AS/400<br />

externally described file. The import file can be a database source file, an<br />

Chapter 4. Copying files 141

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

Saved successfully!

Ooh no, something went wrong!