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



Sorry about the delay in responding, I have been out of the
office.

This sounds like it will work. I will try it and see.

Thanks for the reply

John

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Friday, January 17, 2014 7:17 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Question about using QMHRCVM and QMHRMVM Apis

On 16-Jan-2014 05:30 -0800, John Allen wrote:
I am using QMHRCVM API to read through a message Queue,
this works
fine

I am also using QMHRMVM to remove some of the messages
this works fine
except...

I want to make sure I do not attempt to remove an Inquiry
message that
is waiting for a response.

I receive the message type from QMHRCVM but I do not see
any type of
Message Status field in the QMHRCVM API results.

How can I make sure I do not attempt to remove a message
that is
awaiting a response.

There is no specific messages I am trying to remove or
skip. I just
need to be able to read all messages in a message queue
and skip those
waiting a response

The use of [those] APIs is not specific to the RPG
language; i.e.
probably more appropriate on midrange-l. Regardless...

Seems the intent is to effect the same as "F16=Remove all
except unanswered" from the Display Messages panel.?

When a message of type *INQ is located, the message key
associated with [received for] that Inquiry message can be
used on an additional invocation of the Receive Nonprogram
Message (QMHRCVM) API [or RCVMSG] to ask explicitly for the
*RPY message associated with that key. If the API indicates
nothing is returned [blanks returned for RCVMSG] for the
requested message, then that inquiry message is unanswered;
i.e. the inquiry with no reply is awaiting a reply.

To delete messages other than unanswered inquiries, just
skip all inquiries [in the remove message processing], and
only delete the reply messages. By deleting the reply
message, the inquiry to which the reply was applied is
deleted implicitly.


While probably not the best code [e.g. may be able to
code without any concern for a CPF2410 and using a DoWhile],
the following code snippet should be sufficient to show how
the reply message associated with the inquiry message can be
received. The article does not point out that the replies
will be encountered again as *NEXT messages, in the coded
loop:

http://www.mcpressonline.com/tips-techniques/system-administ
ration/techtalk-receiving-messages-and-their-replies.html
TechTalk: Receiving Messages and Their Replies Tips &
Techniques - System Administration Written by MC Press
Contributing Author Sunday, 28 February 1993 18:00
From: Mark Read To: All

"I was wondering if anyone could help me with the Receive
Message
(RCVMSG) command. I have set up a CL program with the
following command:

RCVMSG MSGQ(&MSGQ) MSGTYPE(*NEXT) MSGKEY(*TOP) +
MSG(&MSGTXT) SENDER(&MSGSNDR)

This CL program is called from another program that will
print the message data that is passed back via the
parameters. Here's the problem that I'm having: if an
inquiry message is in the message queue, I cannot seem to
get the reply information.

...

DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(2)
DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&MSGTXT) TYPE(*CHAR) LEN(80)
DCL VAR(&RPYTXT) TYPE(*CHAR) LEN(80)
RCVMSG MSGQ(...) MSGTYPE(*NEXT) MSGKEY(*TOP) RMV(*NO) +
KEYVAR(&MSGKEY) MSG(&MSGTXT) RTNTYPE(&MSGTYPE)
LOOP: +
IF COND(&MSGTYPE *EQ '05') THEN(DO)
RCVMSG MSGQ(...) MSGTYPE(*RPY) MSGKEY(&MSGKEY) +
RMV(*NO) MSG(&RPYTXT)
MONMSG MSGID(CPF2410)
GOTO CMDLBL(ENDLOOP)
ENDDO
RCVMSG MSGQ(...) MSGTYPE(*NEXT) MSGKEY(&MSGKEY) +
RMV(*NO) KEYVAR(&MSGKEY) MSG(&MSGTXT)
RTNTYPE(&MSGTYPE)
MONMSG MSGID(CPF2410) EXEC(GOTO CMDLBL(ENDLOOP))
Goto cmdlbl(loop)
ENDLOOP:
/* &MSGTXT will contain *INQ message if one exists in the
message queue.*/
/* &RPYTXT will contain reply data if a reply was given.
*/

--
Regards, Chuck
--
This is the RPG programming on the IBM i (AS/400 and
iSeries) (RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


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