CLOSEQUEUE

Closes a message queue.
Supports: MQSeries, MQSeries C, MSMQ, Rendezvous, Rendezvous-CM

Syntax

CALL CLOSEQUEUE(qid,rc , attr>);

Required Arguments

qid
Numeric, input
Specifies the handle of a queue that is obtained from a previous OPENQUEUE function call.
rc
Numeric, output
Provides the return code from the CALL routine. If an error occurs, then the return code is nonzero. You can use the SAS function SYSMSG() in order to obtain a textual description of the return code.
attr
Character, input
Specifies a delete attribute. The following attributes are valid:
DELETE
Specifies that the queue is to be deleted after it successfully closes, but only if there are no messages on the queue. This attribute is supported with MQSeries only. It is not supported with MSMQ because there is no way to programmatically determine the depth of the queue. It is not supported with Rendezvous because Rendezvous handles this function internally.
DELETE_PURGE
Causes the queue to be deleted, even if the queue depth is greater than zero. This attribute is supported with MQSeries, MQSeries C, MSMQ, and Rendezvous-CM. It is not supported with Rendezvous because Rendezvous handles this function internally. If you are using Rendezvous Certified Message Delivery, when you close a listener queue the default setting is for the sender to save messages for persistent messaging. If you do not want messages to be saved by the sender or do not want persistent messaging, specify the DELETE_PURGE attribute when you close the queue. Setting the DELETE_PURGE attribute is the same as setting the cancelAgreements argument on TIBRVCM_CANCEL(TRUE).

Example

The following example closes a queue:
length msg $ 200;
length qid rc 8;
rc=0;
call closequeue(qid, rc);
if rc ^= 0 then do;
  put 'CLOSEQUEUE: failed';
  msg = sysmsg();
  put msg;
end;
else put 'CLOSEQUEUE: succeeded';