<原创><AS/400>关于CPYFRMIMPF的应用
上一篇 /
下一篇 2008-06-18 17:15:12
/ 个人分类:AS/400 技术
CPYFRMIMPF(Copy from import file):The Copy From Import File (CPYFRMIMPF) command copies all or part of an import file to the TOFILE. The term import file is used to describe a file created for purposes of copying data between heterogeneous databases. The import file (FROMSTMF or FROMFILE parameter) is called the from-file for this command. An important aspect of this command is its ability to copy the data in parallel. By using the Change Query Attributes (CHGQRYA) command, the number of tasks used to perform. the copy is determined by the DEGREE parameter of the CHGQRYA command. For the best performance in implementing this command, the number of tasks should be set to the number of CPUs + 1.
Coping a file from-file to an extenally-decribed physical file. the to-file must exist on the on the system before the copy can occur.
some action can improve the performance: 1>Delete any logical keyed file based on the to-file. 2>Remove all the constraints and trigger of the to-file. 3>Use the ERRLVL(*NOMAX) parameter after knowing the data can be copied correctly. 4>When the ERRLVL(*NOMAX) parameter is used, record blocking is done for an increase in performance. If an error in writing a record occurs when during record blocking, the number of records listed as being copied in the completion message, CPC2955, may not be accurate..
Notes For Delimited Data: 1. A delimiter can not be a blank(' ') character. 2. A blank(' ') can not be contained within a numeric field. 3. Fields in the from-file that are longer than the corresponding fields in the to-file will be truncated (on the right). 4. If the data of the from-file does not represent all the fields in the to-file, the fields of the to-file will be set to null.If this happens and the to-file fields do not allow a null value, an error will occur and the record will not be copied to the to-file. 5. A null field in the from-file can be specified by two adjacent field delimiters, two adjacent string delimiters, a field delimiter followed by a record delimiter, or a field of all blanks.
Notes For Fixed Data: The information for each field of the fixed format file must be in the following order:
Field Starting Ending Null
Name Position Position Character Position
_________________________________________________________
Field1 1 10 11
Field2 12 15 16
*END
The information for this Field Definition File would be: 1. Field1 is the name of the field in the to-file. 2. The starting position is the byte in the from-file where the data will be copied from. 3. The ending position is the byte in the from-file where the data will be copied from. 4. The null character position is the byte in the from-file to indicate if the field is null. A value of 'Y' means the field is null. A value of 'N' means the field is not null. If this value is 0, no null character is provided. 5. The *END is the indicator for the end of the Field Definition File.
For example:
1.Delimited Data: CPYFRMIMPF FROMFILE(XXXXXX) TOFILE(XXXXXX) +
MBROPT(*REPLACE) FLDDLM(*TAB) +
ERRRCDFILE(*LIBL/XXXXXX *FIRST) +
RPLNULLVAL(*FLDDFT)
2. Fixed Data: CPYFRMIMPF FROMSTMF('/XXX/XXXXX/XXXXX/PC file name') TOFILE(XXXXXx)
MBROPT(*REPLACE) RCDDLM(*CRLF) DTAFMT(*FIXED)
RMVBLANK(*NONE) FLDDFNFILE(XXXXX) ERRLVL(*NOMAX)
RPLNULLVAL(*FLDDFT) For FLDDFNFILE(XXXXX) should be difine as mention above.
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: