ibm-midrange - 调用传递数组的外部程序时如何使用 LIKE 关键字

标签 ibm-midrange rpgle

我有以下 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

请参阅6.1 Infocenter LIKE() keyword

关于ibm-midrange - 调用传递数组的外部程序时如何使用 LIKE 关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21417532/

相关文章:

java - 使用存储过程的数据库中的对象锁定问题

sql - DB2-如何在IBM System i Access for Windows GUI工具中使用参数运行临时选择查询

rpgle - 如何让 RPG 程序在内存中运行?

rpgle - 在原型(prototype)和过程接口(interface)之间共享定义

c - 按回车键在多个显示记录格式之间切换

java - 动态获取结果集列和值

sql - IBM AS400 与 SQL Server 数据库之间的数据集成

ibm-midrange - 是否可以通过RPGILE中的物理文件获取指针读取的位置?

ibm-midrange - 在 DSPF 中包含带有 MSGID 的动态文本

ibm-midrange - 如何在编译 AS400 对象(RPG、CLLE 等)时指定库列表