Jim Wiant wrote:

Thanks a lot for the clarification Barbara.

I want to be clear about FREE - are you referring to /Free (Free Format
RPG)? If so, are you saying that if the call command is within the free
format syntax, it will behave as I expect (i.e. resolving the library
list each call?)

Oops, sorry for the confusion.  No, I mean the FREE opcode in RPG/400:

C          CALL    'PGM001'
C          FREE    'PGM001'
C          CALL    'PGM001'

The ILE RPG behaviour is the same for free-form calls with EXTPGM too. 
You can get around it the same way, by using a variable for EXTPGM, and
using the variable name to call some other program when you want to
re-resolved to your program.

D pgm001        pr          extpgm(pgm001Var)
D   parms ...
D dummy         pr          extpgm(pgm001Var)
D pgm001Var     S      21a
       pgm001Var = 'DUMMY';
       callp (dummy);
       pgm001Var = 'PGM001';
       callp pgm001 (parms ...);

If you had a subprocedure that handled the first three lines, you could
       resetPgm001Var ('PGM001');
       callp pgm001 (parms ...);

Or you could have a subprocedure that actually handled the call to
pgm001; it would have the prototypes with the EXTPGMs, and do all the
business with the call to DUMMY.  (This would work fine unless you had
optional parameters.)
        callp callPgm001 ('PGM001' : parms ...);

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page