Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
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:
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. More information on handling errors is in the Files and file systems category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
Overrides: All overrides are in effect for this command. The parameters of the overrides that are supported by CPYTOIMPF are:
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. More information on preventing status messages from appearing is in the Files and file systems category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
Restrictions:
Note: Do not precede an entry with an asterisk unless that entry is a "special value" that is shown (on the display itself or in the help information) with an asterisk.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMFILE | From file | Element list | Required, Positional 1 |
Element 1: File | Qualified object name | ||
Qualifier 1: File | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
Element 2: Member | Name, *FIRST, *ALL | ||
TOFILE | To data base file | Element list | Optional, Positional 2 |
Element 1: File | Qualified object name | ||
Qualifier 1: File | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
Element 2: Member | Name, *FIRST, *FROMMBR, *ALL | ||
TOSTMF | To stream file | Path name | Optional, Positional 3 |
MBROPT | Replace or add records | *ADD, *REPLACE | Optional |
FROMCCSID | From CCSID | 1-65533, *FILE | Optional |
TOCCSID | To CCSID | 1-65533, *FILE | Optional |
STMFCCSID | Stream file CCSID | 1-65533, *STMF, *PCASCII, *STDASCII | Optional |
STMFCODPAG | Stream file code page | 1-32767, *STMF, *PCASCII, *STDASCII | Optional |
STMFAUT | Stream file authority | *DFT, *INDIR, *FILE, *INDIRFILE | Optional |
RCDDLM | Record delimiter | Character value, *EOR, *CRLF, *LF, *CR, *LFCR | Optional |
DTAFMT | Record format of import file | *DLM, *FIXED | Optional |
STRDLM | String delimiter | Character value, *DBLQUOTE, *NONE | Optional |
STRESCCHR | String escape character | Character value, *STRDLM, *NONE | Optional |
RMVBLANK | Remove blanks | *NONE, *LEADING, *TRAILING, *BOTH | Optional |
FLDDLM | Field delimiter | Character value, ',', *TAB | Optional |
NULLIND | Null field indicator | *NO, *YES | Optional |
NUMFLDPAD | Numeric field pad | *NONE, *BLANK, *ZERO | Optional |
DECPNT | Decimal point | *PERIOD, *COMMA | Optional |
DATFMT | Date format | *ISO, *USA, *EUR, *JIS, *YYMD | Optional |
TIMFMT | Time format | *ISO, *USA, *EUR, *JIS | Optional |
Top |
Specifies the file that contains the records to be copied. The database file can be a single-format logical, physical, or multi-system file.
This is a required parameter.
Element 1: File
Qualifier 1: File
Qualifier 2: Library
Element 2: Member
Top |
Specifies the database file to receive the copied records. Either this parameter or the TOSTMF parameter is required.
The to-file can be any of the following file types:
Element 1: File
Qualifier 1: File
Qualifier 2: Library
Element 2: Member
Specifying *FIRST is not allowed if the specified to-file has no members and there is no override (OVRDBF command) in effect that specified a member name for the to-file.
Top |
Specifies the output stream file to which data is to be copied. Either this parameter or the TOFILE parameter is required. All directories in the path name must exist. New directories are not created. If the stream file does not exist, it will be created.
Note: The QSYS.LIB file system does not allow attributes to be set, so if the path name specified on the TOSTMF parameter is a QSYS member, diagnostic messages will appear in the joblog. The diagnostic messages will not prevent the copy operation from completing successfully.
Note: This parameter is Unicode-enabled. See "Unicode support in CL" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/ for additional information.
Top |
Specifies whether the copy operation replaces, adds, or fails to copy to the records in the to-file member if a member with the specified name already exists. If the member does not exist, it is created and added to the to-file.
Note: If *ADD is specified and the to-file contains no records, the copy operation completes normally. If *REPLACE is specified and the to-file contains no records, the copy operation ends abnormally.
Additional information is available in the Files and file systems category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
Top |
Specifies the coded character set identifier (CCSID) to use for the from-file fields.
Top |
Specifies the coded character set identifier (CCSID) to use for the file specified for the To data base file (TOFILE) parameter.
Top |
Specifies the method of obtaining the stream file coded character set identifier (CCSID) equivalent of the code page that is used for data conversion.
This parameter can not be specified with the Stream file code page (STMFCODPAG) parameter.
If the stream file does not exist, the CCSID equivalent of the source database file CCSID is used and associated with the stream file.
If the stream file does not exist, a CCSID in the IBM PC Data encoding scheme (x2100) is computed. This CCSID is associated with the target stream file and is used for data conversion if it is requested.
If the stream file does not exist, a CCSID in the Microsoft Windows encoding scheme (x4105) is computed. (Microsoft and Windows are registered trademarks of Microsoft Corporation). This CCSID is associated with the target stream file and is used for data conversion if it is requested. This option allows the resulting data to be used by Microsoft Windows applications.
Top |
Specifies the method of obtaining the stream file code page and the coded character set identifier (CCSID) equivalent of the code page that is used for data conversion.
This parameter can not be specified with the Stream file CCSID (STMFCCSID) parameter.
Note: This parameter is replaced by STMFCCSID but the STMFCODPAG parameter can still be used. However, because this parameter may be removed in a later release, use the STMFCCSID parameter whenever possible.
If the stream file does not exist, the code page equivalent of the source database file CCSID is used and associated with the stream file.
If the stream file does not exist, a code page in the IBM PC Data encoding scheme (x2100) is computed. This code page is associated with the target stream file and is used for data conversion if it is requested.
If the stream file does not exist, a code page in the Microsoft Windows encoding scheme (x4105) is computed. (Microsoft and Windows are registered trademarks of Microsoft Corporation). This code page is associated with the target stream file and is used for data conversion if it is requested. This option allows the resulting data to be used by Microsoft Windows applications.
Top |
Specifies the method of assigning authority settings to the specified output stream file to which data is to be copied. If the specified output stream file already exists, this parameter is ignored.
If the from-file object is a multi-system file, the default value *DFT is used instead of the *FILE value.
If the from-file object is a multi-system file, the default value *INDIR is used instead of the *INDIRFILE value.
Top |
Specifies the record delimiter of the to-file.
If the TOFILE parameter is specified, valid values are *EOR or a character value. If the TOSTMF parameter is specified, valid values are *CR, *CRLF, *LF, *LFCR or *ALL.
Top |
Specifies the format of the data of the generated to-file.
Top |
Specifies the string delimiter for the data of the fields being copied to. This character indicates the start and end of character, date, time, and timestamp strings in the to-file. Depending on the utility used to create the to-file, some types of strings may appear in the to-file without string delimiter characters.
The specified delimiter character will be converted from the coded character set identifier (CCSID) of the job to the CCSID of the to-file. If the to-file CCSID is 1200, 1208, or 13488 the delimiter is converted to the job CCSID, or to the job's default CCSID when the job CCSID is 65535.
Top |
Specifies the escape character to be generated within string fields in the to-file. Character fields in the to-file may contain characters that have a special meaning to the import utility. These characters include the string delimiter and the string escape character itself.
The string escape character precedes such characters in the to-file data and revokes their special meaning. The import utility can then determine if the character is data or a string delimiter.
The specified string escape character will be converted from the coded character set identifier (CCSID) of the job to the CCSID of the to-file. If the to-file CCSID is 1200, 1208, or 13488 the string escape character is converted to the job CCSID, or the job's default CCSID when the job CCSID is 65535.
Top |
Specifies whether blanks are removed or retained. This parameter is ignored when the DTAFMT parameter is set to *FIXED.
Top |
Specifies the field delimiter for the record. This value is placed between fields.
Top |
Specifies whether the first character following each field will contain either a Y or N indicating if the field is null. NULLIND(*YES) is only valid if *FIXED is specified for the Record format of import file (DTAFMT) parameter.
Top |
Specifies the padding applied for numeric fields. This parameter is ignored when the DTAFMT parameter is not *FIXED.
Top |
Specifies the decimal point character to be used when copying numeric data to the to-file.
Top |
Specifies the date format to be used when copying date fields to the to-file.
Top |
Specifies the time format to be used when copying time fields to the to-file.
Top |
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.
Top |
Top |