endmqm

endmqm is how you stop an IBM MQ queue manager without pulling the power cord. Every patch Tuesday, every certificate rotation on the host, and every decommission rehearsal should use endmqm with flags chosen deliberately—not kill -9 on the process unless firefighting. Controlled endmqm lets applications commit syncpoints, channels complete in-flight batches where possible, and persistent messages land safely on disk. Immediate endmqm exists for when the datacenter is flooding; you pay for it on the next strmqm with log replay and indoubt resolution. This tutorial documents endmqm syntax and common flags, pre-shutdown runbook steps, interaction with listeners and channels, dspmq verification, pairing with dmpmqcfg backup timing, difference from dltmqm, z/OS operator equivalents at overview, and mistakes that leave partners in RETRYING because channels were not stopped gracefully.

Controlled Shutdown Sequence

Production sequence: announce maintenance window, stop upstream producers or pause triggers, wait for critical CURDEPTH to drain or accept documented backlog, STOP CHANNEL on key pairs, STOP LISTENER if inbound must halt, run endmqm with wait flags appropriate for your applications, verify dspmq ended, take filesystem backup or OS patch, strmqm, verify Running, START LISTENER and channels, smoke test, reopen applications. Skipping channel STOP may leave partners retrying against a host that is mid-shutdown.

shell
1
2
3
4
5
6
7
8
9
# Controlled stop — verify flags with: endmqm -h endmqm -w 300 QM1 # -w — wait up to 300 seconds for apps to disconnect (example; check manual) dspmq -m QM1 # Status should not be Running # Emergency immediate (use rarely): endmqm -i QM1
Shutdown style comparison
StyleTypical commandNext strmqm
Controlled with waitendmqm -w n QM1Usually faster replay
Default controlledendmqm QM1Moderate replay
Immediateendmqm -i QM1Longer replay; indoubt risk
OS killkill -9 processWorst case recovery

Applications and Syncpoints

Applications in a unit of work receive MQRC when the queue manager quiesces. Well-behaved programs commit or rollback before disconnect. Batch jobs mid-syncpoint may need to rollback on restart. Coordinate with DB2 or other XA resources when using global transactions—endmqm on MQ alone does not commit the database. Two-phase commit tutorials apply. Give consumers time to finish GET and commit when using endmqm -w.

Transmission Queues at Shutdown

Messages on XMITQ are persistent if the messages were persistent—they survive endmqm. Non-persistent messages may be lost on immediate stop. Partners with deep XMITQ during your shutdown see RETRY when you are down—communicate expected gap. Do not endmqm during peak settlement without business approval if backlog is material.

Backup Timing with dmpmqcfg

Run dmpmqcfg while the queue manager is running to export live configuration. For file-level backup of queue manager directories, many procedures require endmqm first for crash-consistent copy—follow IBM backup guide. Mixing live file copy without quiesce risks unusable restore. Document which backup type your DR plan uses.

endmqm Versus dltmqm

endmqm stops the process; data remains for next strmqm. dltmqm removes the queue manager definition and can delete data directories—irreversible without restore from backup. Script reviews should flag any line containing dltmqm. Decommission runbooks: endmqm, final dmpmqcfg, archive export, then dltmqm after retention period.

Automation Pitfalls

  • Ansible playbooks that endmqm all nodes simultaneously in active/active without traffic drain.
  • Docker stop without SIGTERM grace period equivalent to endmqm.
  • Forgetting multi-instance standby partner still serving—coordinate failover first.
  • OS shutdown without endmqm—same as unclean stop.

Explainer: Closing the Post Office for the Night

Controlled endmqm is locking the door after the last clerk finishes the drawer. Immediate endmqm is pulling the fire alarm—everyone drops papers and runs; cleanup takes longer tomorrow.

Explain Like I'm Five: endmqm

endmqm is telling everyone in the mail building to finish their desk and turn off the lights before the building sleeps.

Practice Exercises

Exercise 1

Stop lab QM with endmqm -w; note dspmq and time next strmqm.

Exercise 2

Compare AMQERR after immediate versus controlled stop.

Exercise 3

Write maintenance ticket template listing steps before endmqm.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. endmqm is used to:

  • Stop queue manager
  • Create queue manager
  • Put messages
  • Export config only

2. Immediate endmqm increases:

  • Recovery time on next strmqm
  • Channel BATCHSZ
  • MAXDEPTH
  • Topic count

3. endmqm versus dltmqm:

  • endmqm stops; dltmqm deletes QM
  • Same command
  • dltmqm stops only
  • endmqm deletes messages only

4. Before production endmqm:

  • Notify apps and drain where possible
  • Delete logs first
  • RESET all channels only
  • Skip backup
Published
Read time21 min
AuthorMainframeMaster
Verified: IBM MQ 9.4 documentation