× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.

On 11/09/2005, at 11:54 AM, M. Lazarus wrote:

Once I have retrieved a *RPY (any variety) message, is there a way to directly link to its corresponding the *INQ message?

My initial thought was: Of course, the link is via the message key value. Consider:

When you send an *INQ message you fetch the reply by specifying the message key returned by SNDPGMMSG (or equivalent API). Therefore when you have a *RPY message you ought to be able to obtain the associated *INQ message by using the message key of the reply.

However, experimentation shows that although you can find the *RPY message using the *INQ message key you cannot do the reverse.

Once you have the *INQ message key you can toggle between retrieving the *INQ or associated *RPY message simply by changing the MSGTYPE. When you have the *RPY message key and you specify *INQ for MSGTYPE you get CPF2410. You get this error whether you use the original reply or the sender copy.

You can also find the *RPY via the message key of the sender's copy of the *INQ message.

How does IBM do it when viewing a *MSGQ's messages?

By magic??? I figured there had to be a link between the two parts so started dumping message queue objects. I haven't fully deciphered the structure but most of it is straightforward. The structure is different for each message type. Interestingly the 'message key' is actually an offset into the associated space of the message queue and locates the start of the message structure.

Although the structure indicates a link between the *RPY and the *INQ message via a message key value it seems this value is not exposed via either the RCVMSG command nor the QMHRCVM API.

It appears that IBM code never links the *RPY to the *INQ. It always does the reverse--that is links the *INQ to the *RPY. Even if other messages were sent between the *INQ and the *RPY the *INQ and *RPY always appear together. Prompt the DSPMSG command and examine the values for MSGTYPE. You can only specify *ALL, *INFO, *INQ, or *COPY. If you specify *INQ or *COPY you will also get the associated *RPY message. So IBM code finds an *INQ message and then checks for a *RPY. If it finds one it is displayed otherwise it shows an input field where a reply could be typed.

If this info is available, I would appreciate some sample code. If possible, RPG using the appropriate MI built-ins, since this info does not seem to be available via traditional means. TIA.

You can link from the *INQ to the *RPY in CL using RCVMSG commands therefore it can also be done using the APIs from RPG or other HLL.

I suggest you change your process to look for the *RPY when you find an *INQ message instead of attempting the reverse.

Simon Coulter.
   FlyByNight Software         AS/400 Technical Specialists

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                 ASCII Ribbon campaign against HTML E-Mail  / \

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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