MSMQOPENQUEUE
Opens a queue for sending message to the queue or
for reading its messages.
Syntax
CALL MSMQOPENQUEUE(qid, access, shareMode, hQueue, rc);
Required Arguments
- qid
-
Numeric, input
Specifies the queue
identifier that represents the format name of the queue to be opened.
- access
-
Character, input
Indicates the level
of access that users have to the messages in the queue being opened.
The following values are valid:
- PEEK
-
Specifies that messages can only be
read.
- SEND
-
Specifies that messages can only be
sent to the queue.
- RECEIVE
-
Specifies that messages
can be read and removed from the queue.
- shareMode
-
Character, input
Specifies how the queue
is shared. The following values are valid:
- SHARE
-
Specifies that the
queue is available to everyone.
- DENY_SHARE
-
Specifies that the
process making this function call is the only one that can receive
messages from this queue. If the queue is already opened for receiving
messages by another process, then this call will fail.
- hQueue
-
Numeric, output
Returns the MSMQ handle
of the opened queue. This handle is used by subsequent CALL routines
to identify and access the queue.
- rc
-
Numeric, output
Provides the return
code from the CALL routine. If an error occurs, then the return code
is nonzero. A return code of -1 reflects a SAS internal error. Otherwise,
it represents an MSMQ error code. You can use the SAS function SYSMSG()
to obtain a textual description of the return code.
Example: Example
This example opens a
queue for sending messages.
length msg $ 200;
hQueue=0;
rc=0;
CALL MSMQOPENQUEUE(qid, "SEND", "SHARE", hQueue, rc);
if rc ^= 0 then do;
put 'MSMQOpenQueue: failed';
msg = sysmsg();
put msg;
end;
else put 'MSMQOpenQueue: succeeded';