Guardian Programmer's Guide

Table Of Contents
Communicating With Processes
Guardian Programmer’s Guide 421922-014
6 - 25
Using the MESSAGESTATUS Procedure
To enable receipt of cancellation messages in its $RECEIVE file, the server process
must call SETMODE function 80. SETMODE function 80 controls several functions
related to the $RECEIVE file, one of which is receipt of cancellation messages. For a
list of the functions performed by SETMODE function 80, see the Guardian Procedure
Calls Reference Manual.
The following example enables the receipt of cancellation messages. To receive
cancellation messages, bit 13 of parameter 1 of the SETMODE function 80 call must
be set to 1:
LITERAL SET^RECV^MSG^MODE = 80,
ACCEPT^CANCEL^MESSAGES = %B0000000000000100;
.
.
CALL SETMODE(RECV^NUM,
SET^RECV^MSG^MODE,
ACCEPT^CANCEL^MESSAGES);
Once a call to SETMODE function 80 has been issued, you can check for cancellation
messages as you would any other system message. See , later in this section.
Using the MESSAGESTATUS Procedure
Cancellation messages provide a general mechanism for checking for canceled
messages. However, to request explicit information about the cancellation status of a
particular message that was read from $RECEIVE, your server program can call the
MESSAGESTATUS procedure. The MESSAGESTATUS procedure is the only way to
test for cancellation if $RECEIVE is opened with a receive depth of 1.
The MESSAGESTATUS procedure returns a value that indicates whether a specified
message has been canceled. You pass the message tag to the MESSAGESTATUS
procedure to identify the message you are inquiring about.
The following example checks the status of the message whose message tag is
MSG^TAG:
STATUS := MESSAGESTATUS(MSG^TAG);
The value returned in STATUS is one of the following:
1 The specified message has been canceled. Thus, a REPLY[X] call is still
required but processing of the request should be terminated. There is no need
to supply data with the reply.
0 The specified message has not been canceled. Thus, the server must process
the message and send the REPLY[X] to the requester process.
-1 The specified message does not exist. No reply call is required.