Is CALLP also a dynamic call or can be considered as static call in ILE RPG

Viewed 247

I have a module which has main procedure and sub procedures in it, the other scripts are using EXTPGM to call modules but few scripts are not using EXTPGM they are using CALLP, can anyone help me in understanding whether CALLP is dynamic call or static call in ILE RPG?

1 Answers

From the manual:

If the keyword EXTPGM is specified on the prototype, the call will be a dynamic external call; otherwise it will be a bound procedure call.

edit
resolution doesn't change. It's resolved during the first call. And not re-resolved as long as the program is active.

The exception to that rule is if EXTPGM() is used with a variable instead of a constant; and the value of the variable changes.

dcl-s pgmToCall varchar(21);
dcl-pr Mypgm extpgm(pgmToCall);
end-pr;

//SOMEPGM will be resolved twice
//  assuming the library list hasn't change
//  both will resolve to the same *PGM
pgmToCall = 'SOMEPGM';
Mypgm();
pgmToCall = '*LIBL/SOMEPGM';
Mypgm();

Note that this is nothing new. The CALL op-code in RPGIII and RPGIV worked the same way.

Related