OPTS (10-digit signed integer) - input

Options that control the action of MQCLOSE.

The OPTS parameter controls how the object is closed. Only permanent dynamic queues can be closed in more than one way, being either retained or deleted; these are queues whose DefinitionType attribute has the value QDPERM (see the DefinitionType attribute described in Attributes for queues). The close options are summarized in Table 49.

One (and only one) of the following must be specified:

CONONE

No optional close processing required.

This must be specified for:

  • Objects other than queues

  • Predefined queues

  • Temporary dynamic queues (but only in those cases where HOBJ is not the handle returned by the MQOPEN call that created the queue).

  • Distribution lists

In all of the above cases, the object is retained and not deleted.

If this option is specified for a temporary dynamic queue:

  • The queue is deleted, if it was created by the MQOPEN call that returned HOBJ; any messages that are on the queue are purged.

  • In all other cases the queue (and any messages on it) are retained.

If this option is specified for a permanent dynamic queue, the queue is retained and not deleted.

CODEL

Delete the queue.

The queue is deleted if either of the following is true:

  • It is a permanent dynamic queue, and there are no messages on the queue and no uncommitted get or put requests outstanding for the queue (either for the current task or any other task).

  • It is the temporary dynamic queue that was created by the MQOPEN call that returned HOBJ. In this case, all the messages on the queue are purged.

In all other cases the call fails with reason code RC2045, and the object is not deleted.

COPURG

Delete the queue, purging any messages on it.

The queue is deleted if either of the following is true:

  • It is a permanent dynamic queue and there are no uncommitted get or put requests outstanding for the queue (either for the current task or any other task).

  • It is the temporary dynamic queue that was created by the MQOPEN call that returned HOBJ.

In all other cases the call fails with reason code RC2045, and the object is not deleted.

Table 49. Effect of MQCLOSE options on various types of object and queue This table shows which close options are valid, and whether the object is retained or deleted.
Type of object or queue CONONE CODEL COPURG
Object other than a queue Retained Not valid Not valid
Predefined queue Retained Not valid Not valid
Permanent dynamic queue Retained Deleted if empty and no pending updates Messages deleted; queue deleted if no pending updates
Temporary dynamic queue (call issued by creator of queue) Deleted Deleted Deleted
Temporary dynamic queue (call not issued by creator of queue) Retained Not valid Not valid
Distribution list Retained Not valid Not valid