I was under the impression that IBM changed this behavior a long time ago
(around the v3r1 era.)  The pointer is only resolved again if the PGMNAM
value is different from the previous call.


Hi, Jim:

This happens if you code in RPG/400 or RPGLE like this:

       CALL   'PGM001'
       MOVEL   'PGM001'   PGMNAM   10
       CALL      PGMNAM

This second case causes RPG to generate the full dynamic call that
"resolves" to the name on each call.  Note that there is more "overhead"
for doing it this way.

For this reason (in order to reduce runtime overhead for needless
re-resolving), when the name of the object called is known at
compile-time, (the first case above), IBM compilers generate the code to
do the "resolve" (issue RSLVSP MI instruction) in the "initialization"
part of the *PGM, so this overhead is incurred just once, and from that
point on, e.g. at the point of the CALL, a pointer to the *PGM is used
(already resolved).

Hope that helps,

Mark S. Waterbury

 > Jim Wiant wrote:
I've noticed a behaviour that I don't understand, and would like some

The situation is program objects and library lists, and is set up as

The library list includes LIB1 and LIB2. LIB1 is 1st in the list, LIB2
is 2nd in the list.

I have two programs that call a sub program. One is RPGLE, and calls the
sub program with a simple CALL verb (not bound, etc.). The other program
is a CLLE and again calls a sub program with a simple CALL verb. In both
cases they make the call, sleep for a few seconds, and then loop and
call the child again.

The child program exists in LIB2. Both parent programs end up executing
the same object in LIB2 when started. So far so good..

If I create a new child program with the same name and place it in LIB1
(which is earlier in the library list) I get different behaviours from
the 2 parent programs:

The RPGLE code continues to execute the child from LIB2, ignoring the
object in LIB1.
The CLLE code finds the new code in LIB1 and starts running it next time
it loops.

In both cases the parent process is started with a SBMJOB command with
the same job description and parameters.

Why the difference? I expected the RPGLE parent program to be doing
dynamic calls and it should pick up the new program object from the
library earlier in the library list just like the CLLE does. I don't
mind if the behaviour is consistent even if different between the
languages, but I would like to understand why the difference and if
there is any way to control it.

Thanks all

Jim Wiant
Foodstuffs, Akl. Ltd.

This thread ...


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