我有以下 RPGLE 程序:
dmypgm pr extpgm('MYPGM')
d myarr like(myarr)
d somevar like(somevar)
d myarr s 64a dim(100)
d somevar s 65a
/free
callp mypgm(myarr: somevar);
*inlr = *on;
/end-free
当我尝试在 V6R1 机器上编译它时,我收到错误消息:
RNF5343 30 1 Array has too many omitted indexes; specification is ignored.
一些documentation告诉我:
RNF5343
Array has too many omitted indexes; specification is ignored.
30
Cause . . . . . : The number of omitted indexes for the array used as an operand on the right side of an assignment operator is greater than the number of omitted indexes for the array specified as the result of the assignment.
Recovery . . . : Reduce the number of omitted indexes for the operand; or increase the number of omitted indexes for the result. Compile again.
这没什么帮助,因为这是一个程序调用,而不是尝试分配一个值(例如使用 EVAL
语句或其他语句)。
如果我将外部程序调用的声明更改为:
dmypgm pr extpgm('MYPGM')
d myarr 64a dim(100)
d somevar like(somevar)
程序可以正常编译。
那么如何将 LIKE
关键字与数组一起用于外部程序定义?
最佳答案
LIKE 仅继承数据类型、长度、数据类型和 CCSID。 要传递数组,请同时使用 LIKE 和 DIM:
dmypgm pr extpgm('MYPGM')
d myarr like(myarr) dim(%elem(myarr))
d somevar like(somevar)
d myarr s 64a dim(100)
d somevar s 65a
关于ibm-midrange - 调用传递数组的外部程序时如何使用 LIKE 关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21417532/