[英]IBM i RPG Program not doing anything
The following code compiled under CRTBNDRPG but when running it is stuck on only 1 I/O. 以下代码在CRTBNDRPG下编译,但是在运行时仅停留在1个I / O上。
All I hav to do is - all of our tables have order number as 8 but this one file has it as 10. So I am just creating the 2 fields i need one making it 8 and the other is ok as it is. 我所要做的就是-我们所有的表的订单号均为8,但是这个文件的序号为10。所以我只是创建2个字段,我需要一个字段将其设置为8,而另一个则可以。 ANy ideas why this little program doesn't take off?
知道为什么这个小程序不成功吗?
FMFHHMH IF E DISK
F* output file
FMFHHMHPK O A E DISK
D*EXTSHP S 13 6
D
C
C READ MFHHMH
C Dow NOT %EOF(MFHHMH)
C iF %found
c MOVE MHORDR MHORDp
c MOVE MHZONE MHZONE
C WRITE MFHHMHP
C READ mfhhmh
C End
C END
C SETON LR
You have created an infinite loop where NOT %EOF
is TRUE but %FOUND
is FALSE . 您创建了一个无限循环,其中
NOT %EOF
为TRUE,但%FOUND
为FALSE 。
Note from the documentation for %FOUND that it does not reflect a status for a READ
operation. 从%FOUND的文档中注意到,它不反映
READ
操作的状态。
The IF
conditional is not needed in your code as the DOW
loop is sufficient to guarantee you have a record. 您的代码中不需要
IF
条件,因为DOW
循环足以保证您有记录。
It's right what saying James in the first answer .. with op-code READ you can use IF %EOF but you can't use IF %FOUND .... Use %FOUND with CHAIN 詹姆斯在第一个答案中说的是对..使用操作码READ可以使用IF%EOF,但不能使用IF%FOUND ....在CHAIN中使用%FOUND
You can also use an sql statement if both tables have a similar structure 如果两个表的结构相似,也可以使用sql语句
INSERT INTO MFHHMHPK (select * from MFHHMH where whateveryouwant) 插入MFHHMHPK(从MFHHMH中选择*,如果您愿意)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.