IBM MQ reason code

MQRC 2162: Queue manager stopping

MQRC 2162 (MQRC_Q_MGR_STOPPING, hex 0872) means an MQI call failed because the queue manager is shutting down. Unlike 2161, the application can't do any more MQ work on this connection and should end or wait to reconnect.

Other names for this code

Also written as RC2162, reason code 2162, MQ 2162, MQ error 2162, MQRC_Q_MGR_STOPPING, 0872, 0x0872, queue manager stopping, MQJE001 Reason 2162, JMSCMQ0001 2162.

What it means

Once a queue manager is stopping, every MQI call on the connection fails with MQCC_FAILED and reason 2162. If the call was an MQGET waiting with MQGMO_WAIT, the wait is cancelled. This happens in an immediate or preemptive shutdown, including one an administrator issues to speed up a controlled shutdown that is taking too long.

The application doesn't need to back out work coordinated by the queue manager, because the queue manager backs it out. If an external transaction manager coordinates the unit of work, the application should issue that manager's back-out call. For client applications, IBM warns that the failing call may have completed even though it reported failure, the same caution as for 2009.

On z/OS, timing decides which code an application sees. Depending on how far the shutdown has got, a call may return 2009 (MQRC_CONNECTION_BROKEN) instead of 2162. Code that handles one should handle the other the same way.

Common causes

  • An administrator stopped the queue manager immediately, for example with endmqm -i or endmqm -p on distributed MQ.
  • On z/OS, an operator issued STOP QMGR MODE(FORCE).
  • A failover moved the queue manager to another node and the old instance is ending.
  • The queue manager is ending because of a serious error, and the error log or SYSLOG shows why.

How to find the problem

  1. Check the queue manager error log, or SYSLOG and the MSTR job log on z/OS, for the stop command or the failure that started the shutdown.
  2. Run dspmq on distributed MQ to see the current state.
  3. In a high availability setup, check which node now runs the queue manager and whether the failover completed.
  4. For clients, compare the time of the 2162 with the server-side shutdown messages to confirm the link.

How to fix it

  • End the application cleanly, or close down its MQ work and wait to reconnect.
  • If an external transaction manager coordinates the work, issue its back-out call.
  • Build reconnect logic, or use automatic client reconnect, so the application resumes when the queue manager returns.
  • Make the program safe to repeat its last call on a client connection, because that call may have completed.
  • Handle 2162 and 2009 the same way in the code that deals with shutdown. Handle 2161 apart from them, because after 2161 the program can still finish its current unit of work.

IBM documentation

IBM documentation: MQRC 2162. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

What is the difference between 2161 and 2162?

2161 is returned during a controlled shutdown and lets the application finish its current work. 2162 means the queue manager is stopping and no further MQI calls will succeed on this connection.

Why did my z/OS program get 2009 instead of 2162?

IBM notes that on z/OS the timing of the shutdown can cause 2009 to be returned instead. Handle both codes the same way.

Do I need to back out after 2162?

Not for units of work the queue manager coordinates, because it backs them out. With an external coordinator, the application should issue the back-out call.