Doug,

You just need to make sure that the message queue you're using for the subfile and the message queue you are sending the messages to are the same.

A subprocedure (or "function" to use C terminology) has a separate call stack entry, and therefore has a separate message queue. So you can't simply send the messages to '*' as you could do if you ran this in the main procedure. You'd want to send it up the stack to the caller or whatever instead. So if your display file uses the program name for the message queue, just make sure the subprocedure sending the message also sends to the program name for the message queue.

-SK



On 6/24/2015 6:42 PM, Englander, Douglas wrote:

I have an ILERPG program with a DSPF. This program executes a function in it that displays a window containing a subfile of a list of choices. The window is defined with OVERLAY. Both the ILERPG program as well as the function, use the program message queue for errors.

When I execute the function with a prototype of EXTPROC, it crashes because it does not know the name of the message file (from the call stack). I have tried in debug, hardcoding the MSGQ parameter for the message queue to the name of the calling program, the service program, an asterisk, as well as the name of the function. I chose those because they are in the call stack. No matter what I do, the function crashes when it writes the message file format.

When I change the prototype to use EXTPGM instead, and compile the function code as a module, then execute a CRTPGM on the module, it does not crash.

Does anyone know if it is possible to use a message queue for messages within a function in a service program, where that function is called by an ILE RPG program? If so, what is the value that is needed for the MSGQ initialization? The MSGQ field I refer to is the one in the DDS associated with the SFLPGMQ(10) keyword.

I assume that it works when I have the prototype set to EXTPGM because that allows another entry in the call stack which works with SFLPGMQ keyword. Is that assumption correct?

We are on V7R1.

Thank you,

Doug


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2022 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.