× 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 1/31/11 10:01 AM, Laine, Rogers wrote:
I have the below CL program that will not return the message text
from &MSGTXT in the RCVMSG command.

What am I missing here.

PGM PARM(&MSGKEY &TOMSGQ &TOLIB)
DCL &MSGKEY *CHAR 4
DCL &TOMSGQ *CHAR 10
DCL &TOLIB *CHAR 10
DCL &MSGTXT *CHAR 132
RCVMSG MSGQ(&TOLIB/&TOMSGQ) MSGTYPE(*ANY) +
KEYVAR(&MSGKEY) MSG(&MSGTXT)
SNDMSG MSG(&MSGTXT) TOUSR(MISRML1)


The program [as coded] works fine for me, considering that...

The MsgKey as a parameter is coded to function as a return value, not as a means to locate any particular message. As Scott K suggests, use MSGKEY(&MSGKEY) instead of KEYVAR(&MSGKEY), if intending to perform selection of a message by its message key.

If there are no messages in the named non-program message queue, then the value of &MSGTXT and &MSGKEY will be blanks, and the same effect for when there were only "old messages" available on the *MSGQ. For testing, note that the CL request to CHGMSGQ TheLib/TheMsgQname RESET(*YES) may be valuable to reset any previously "received" messages [old messages] left on the queue from either an explicit or a defaulted RMV(*NO) on some prior RCVMSG [test] processing. An "old message" can not be retrieved via MSGTYPE(*ANY) [nor via MSGTYPE(*INFO) noted in another message as having had provided desirable results]; a MSGKEY() must be utilized, or an "ordered" selection via MSGTYPE() such as *FIRST, *LAST must be requested.

Regards, Chuck

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-2024 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.