MainframeKit

2042

MQRC_OBJECT_IN_USE (X'07FA')MQ REASON CODE

MQOPEN failed because the queue is already open by someone else with options that clash with this request, often exclusive input.

MOST LIKELY

A second copy of the same consumer started while the first holds exclusive input.

FIRST CHECK

Run DISPLAY QSTATUS(name) TYPE(HANDLE) to see which application or job has the queue open and how.

TRY IT ▸

MainframeKit assistant

What it means

Two openers want incompatible access. For example, a program asks for shared input but another has the queue open for exclusive input, or a program asks for exclusive input but someone already has it open for input. The queue's SHARE or NOSHARE setting can force input opens to be exclusive whatever the program asks.

This code can also appear when the queue is being deleted. Receiver channels and the intra-group queuing agent may keep queues open even when idle.

Typical causes

  • A second copy of the same consumer started while the first holds exclusive input.
  • The queue is defined NOSHARE, or uses default open options that resolve to exclusive.
  • A previous instance of the program is still running or hung, holding the queue.
  • On z/OS, the queue is in the middle of being deleted.

How to fix it

  1. Run DISPLAY QSTATUS(name) TYPE(HANDLE) to see which application or job has the queue open and how.
  2. Decide if more than one consumer is wanted. If yes, set SHARE on the queue and open with shared input (MQOO_INPUT_SHARED).
  3. If only one consumer is wanted, stop the old instance or let the new one wait and retry.
  4. Check DEFSOPT on the queue if the program uses MQOO_INPUT_AS_Q_DEF.

Example

Illustrative only; names and values are invented.

MQOPEN failed  CompCode=2  Reason=2042  Queue=APP.REQUEST.QUEUE
DISPLAY QSTATUS(APP.REQUEST.QUEUE) TYPE(HANDLE) APPLTAG OPENOPTS