Queue Manager Shutdown

Shutting down an IBM MQ queue manager correctly protects persistent messages, finishes units of work, and keeps partners from seeing half-closed channels. Killing the process without endmqm invites long log replay and in-doubt transactions that operations resolve at 3 a.m. This page covers endmqm options, quiesce versus immediate stop, draining applications and transmission queues, stopping listeners and channels first, z/OS considerations, maintenance window runbooks, and how shutdown pairs with startup and lifecycle decommission. Beginners learn the commands; operators learn the sequence enterprises expect before patching a server.

endmqm Controlled Shutdown

endmqm QM1 asks the queue manager to stop after disconnecting clients according to policy. Review IBM documentation for your version's flags: waiting for all applications, quiesce mode, and immediate stop. Scripted shutdown in Ansible or shell should log each step and verify dspmq shows ended state before OS patching reboots the host.

Shutdown modes (conceptual—verify flags in your version manual)
ModeBehaviorUse when
Controlled / wait for appsWaits for disconnectPlanned maintenance, apps can stop
QuiesceBlocks new connectionsDrain in-flight work
ImmediateFast stop, more recovery laterEmergency only
OS kill / power lossUncleanNever planned

Recommended Shutdown Sequence

  1. Announce maintenance; stop upstream batch puts.
  2. Pause triggers or disable putting applications.
  3. STOP CHANNEL on sender channels or let quiesce complete transfers.
  4. Wait for critical local queues to drain or accept backlog snapshot.
  5. STOP LISTENER to block new remote connections.
  6. Verify no long-running syncpoint holders (DISPLAY QSTATUS where needed).
  7. Run endmqm; confirm with dspmq.

Transmission Queues and Partners

Stopping while depth remains on XMITQ leaves messages safe if persistent—they forward after next start when channels run. Partners may see channel failures during your shutdown—coordinate windows. In-doubt channel batches may need resolution; check DISPLAY CHSTATUS and partner DLQs after restart.

Applications and Syncpoint

Applications should MQCMIT or roll back open units of work before disconnect. CICS tasks should end with SYNCPOINT or ROLLBACK. Abrupt disconnect mid-UoW leaves messages visible again after restart for syncpoint gets—at-least-once semantics continue. Idempotent consumers handle redelivery after unclean shutdown.

z/OS Shutdown

Queue sharing group members may require coordinated shutdown per IBM recovery procedures. CICS and IMS regions depending on MQ should quiesce first. Started task automation should not restart MQ while maintenance runs on shared CF structures. Follow site standards for VARY CFG and structure recovery.

After Shutdown: Maintenance and Restart

OS patches, certificate updates in key.kdb, disk expansion, and backup jobs run while MQ is down. Document object changes made offline (rare). strmqm brings service back—verify listeners, channels, and a smoke-test put/get before opening full traffic. Compare DLQ and backout depth to pre-maintenance baselines.

Decommission: endmqm vs dltmqm

Retiring a queue manager: controlled endmqm, full backup of /var/mqm or data sets, export MQSC definitions, stakeholder sign-off, then dltmqm to remove. Skipping backup before dltmqm is a career-limiting event. Lifecycle tutorial covers governance; shutdown tutorial covers the stop command itself.

Tutorial: Maintenance Window Script Outline

shell
1
2
3
4
5
6
7
8
9
10
# 1. Stop inbound traffic (apps, triggers) echo "STOP CHANNEL(TO.PARTNER)" | runmqsc QM1 echo "STOP LISTENER(LISTENER.TCP)" | runmqsc QM1 # 2. Optional: DISPLAY QLOCAL(*) CURDEPTH — document backlog endmqm QM1 dspmq -m QM1 /* verify not running */ # --- OS maintenance --- strmqm QM1 echo "START LISTENER(LISTENER.TCP)" | runmqsc QM1 echo "START CHANNEL(TO.PARTNER)" | runmqsc QM1

Explain Like I'm Five: Shutdown

The library closes for the night: finish checking out books (drain apps), lock the drop box (stop listeners), turn off lights (endmqm). If you pull the fire alarm and run away (kill process), the librarian spends extra time sorting scattered books tomorrow morning (log recovery).

Practice Exercises

Exercise 1: Script Review

A script runs dltmqm for nightly restart. What is wrong?

Exercise 2: XMITQ

10,000 persistent messages on XMITQ; controlled endmqm. Are they safe? What on next start?

Exercise 3: Runbook

Write customer-facing notice text for a 30-minute MQ maintenance window.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. endmqm without immediate flags generally:

  • Attempts controlled shutdown
  • Deletes all queues
  • Starts channels
  • Formats disks

2. Immediate or kill-style stop increases:

  • Log recovery time on next start
  • Message persistence always
  • Channel BIND automatically
  • Free disk space

3. Before production endmqm you should:

  • Coordinate with app teams and drain
  • Delete /var/mqm first
  • Skip channel stop
  • Disable backups

4. dltmqm is used when:

  • Decommissioning after backup
  • Daily restart
  • Starting listener
  • Putting messages
Published
Read time14 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation