Pergunta

I have the following RPGLE program:

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

When I attempt to compile this on a V6R1 box I get the error message:

RNF5343 30      1 Array has too many omitted indexes; specification is ignored.

Some documentation tells me:

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.

Which is less than helpful since this is a program call rather than trying to assign a value (like with an EVAL statement or something).

If I change the declaration of my external program call to:

dmypgm            pr                  extpgm('MYPGM')
d  myarr                        64a   dim(100)
d  somevar                            like(somevar)

the program will compile just fine.

So how do I use the LIKE keyword with an array for an external program definition?

Foi útil?

Solução

Only the data type, length, data type and CCSID are inherited with LIKE. To pass an array, use both LIKE and 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

See the 6.1 Infocenter LIKE() keyword.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top