首页 > 学技术 > 技术网文 > IBM AS400应用论坛 > 正文

[原创] AS400命令集-CPYTOIMPF的用法(已验证)


来源 chinaunix.net 酷勤网整理

[font=Verdana]AS400命令集-CPYTOIMPF的用法(已验证)

AS400命令集-CPYTOIMPF的用法

我在使用过程中,总是出现这样的错误。。


Cause . . . . . :   No records were copied from member or label P01 in file   
P01 in library DX001LIB because the from-file member or label did not   
contain records or records did not meet the selection requirements.     
Technical description . . . . . . . . :   If the from-file or to-file member   
or label name is *N, the file is a printer, nonlabeled tape, or a inline   
data file. If the from-file library name is *N, the file is a inline data   
file. Records are copied based on the following selection requirements:   
-- For CPYF command, character values specified on the INCCHAR parameter. 
-- For CPYF command, field values specified on the INCREL parameter.   
-- For CPYFRMQRYF command, query selection specified on the OPNQRYF   
command.


正确用法
                Copy To Import File (CPYTOIMPF)                 
                                                    
Type choices, press Enter.                                   
                                                    
From file:                                               
  File . . . . . . . . . . . . . > P01       Name                 
  Library . . . . . . . . . . >   DX001LIB   Name, *LIBL, *CURLIB       
  Member . . . . . . . . . . . .   *FIRST     Name, *FIRST, *ALL         
To data base file:                                         
  File . . . . . . . . . . . . .           Name                 
  Library . . . . . . . . . .   *LIBL     Name, *LIBL, *CURLIB       
  Member . . . . . . . . . . . .   *FIRST     Name, *FIRST, *FROMMBR, *ALL 
To stream file . . . . . . . . . > '/TEST/P01.CSV'                   
                                                    
Replace or add records . . . . . > *REPLACE     *ADD, *REPLACE           
Stream file code page . . . . . > *STDASCII   1-32767, *STMF, *PCASCII...   
Record delimiter . . . . . . . . > *CRLF       Character value, *EOR...     
Record format of import file . .   *DLM       *DLM, *FIXED             
String delimiter . . . . . . . .   '"'       Character value, *NONE     
Field delimiter . . . . . . . .   ','       Character value           

CPYTOIMPF 
FROMFILE(DX001LIB/P01) 
TOSTMF('/TEST/P01.CSV') 
MBROPT(*REPLACE) 
STMFCODPAG(*STDASCII) 
RCDDLM(*CRLF)

说明一下:

1.很多资料都是介绍将物理文件共享到,集成文件系统的QDLS,但测试时总是不成功,所以打电话咨询IBM,说是QDLS已经不推荐使用,集成文件系统多使用ROOT就可以了。
2.在ROOT下面建立一个文件夹,在此为TEST,设定权限为只读。
3.CPYTOIMPF中的TOSTMF参数设定。虽然在iSeries浏览器中看到的目录结构是这样的:Root/Test,但在参数中设定时要直接指定/Test才行,目录与文件名之间用“/”来区分,另外STMFCODPAG参数,一定要指定为*STDASCII,要不然得到的CSV文件中,全部都是乱码,无法解读。
4.这样就可以了。[/font]



 fairyboy 回复于:2005-11-14 23:20:20

虽然没用过,不过看了帖子,觉得不错,顶一下


 sa_hata 回复于:2005-11-19 13:09:56

收藏,嘿嘿........


 l.rover 回复于:2005-11-19 20:09:56

学习。


 liushengheng 回复于:2005-11-21 17:12:00

如何察看/test目录下的文件?
采用ftp下传数据时无法指定该目录,请指教如何下载


 michael9406 回复于:2005-11-21 20:05:03

如果遇到中文处理仍是个问题。因为到CSV后,是乱的,我的意思是错位。


 sucretiger 回复于:2006-10-18 17:06:52

引用:原帖由 michael9406 于 2005-11-21 20:05 发表
如果遇到中文处理仍是个问题。因为到CSV后,是乱的,我的意思是错位。 



这倒没注意,因为我们的系统中,没有中文的,呵呵..

不过老大提的还是对的,,不知道有什么解决方法吗?


 sucretiger 回复于:2006-10-18 17:08:42

引用:原帖由 liushengheng 于 2005-11-21 17:12 发表
如何察看/test目录下的文件?
采用ftp下传数据时无法指定该目录,请指教如何下载 



FTP我就没有了,通过网上邻居直接访问就可以了啊...

通过网上邻居直接访问400服务器,输入400上的用户名和密码就可以了.




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=648255
转载请注明作者名及原文出处



收藏本页到: