On 12/08/2008, at 1:45 AM, Lim Hock-Chai wrote:

I've always assumed each program/service program on the call stack has
its own program message queue. I guess I'm wrong on the service program

OPM: Only things in the call stack are *PGM objects. Send a message to a program name and things work as expected.

ILE: Call stack is no-longer *PGM based but procedure-based. Each procedure gets a call stack entry. Notice that parameter 6 for QMHSNDPM says "You can specify a call stack entry by providing the name of the OPM program or ILE procedure running in the entry".

You may encounter the same problem (of no call stack entry) when using ILE *PGM objects. You're probably not getting this error more by luck than design. If the entry module of your ILE *PGM is the same name as the *PGM then things will appear to work as you expect but it's not quite the same as sending the message to an OPM program. That's because the call stack entry for OPM **IS** the name of the program. However for ILE it is the name of the procedure. For RPG IV that can result in a number of call-stack entries:

1) The entry point program message queue of an RPGLE program is _QRNP_PEP_ concatenated with the entry module name thus to successfully send a message to (or relative to) an ILE RPG program named FRED with an entry module named NURK you must specify the To program queue as '_QRNP_PEP_NURK' if you want the same target level as you would get in OPM.
2) The entry module message queue is the same name as the entry module. In the above example it is NURK.

3) Various program message queues for each procedure invoked by the program.

Thus the call stack for an ILE RPG program named FRED may look like:

QUOCMD (where CALL FRED was processed)
_QRNP_PEP_NURK (derived program entry point)
NURK (main module)
DO_STUFF (procedure in *PGM or *SRVPGM)

In your case you are probably sending the message to 1 call stack level below where you think you are sending it. Whether that causes a problem for you is difficult to say. I know in my interactive program code I always send messages to the derived entry-point name to get similar message handling behaviour to OPM.

Simon Coulter.
FlyByNight Software OS/400, i5/OS Technical Specialists

Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
ASCII Ribbon campaign against HTML E-Mail / \

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].