Previous Page | Next Page

MSMQ Call Routines

MSMQOPENQUEUE



Opens a queue for sending message to the queue or for reading its messages.
Syntax
Arguments
Example

Syntax

CALL MSMQOPENQUEUE(qid, access, shareMode, hQueue, rc);

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

SEND

Specifies that messages can only be sent to the queue.

RECEIVE

Specifies that messages can be looked at 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

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';

Previous Page | Next Page | Top of Page