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.
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.
123456789# 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
| Style | Typical command | Next strmqm |
|---|---|---|
| Controlled with wait | endmqm -w n QM1 | Usually faster replay |
| Default controlled | endmqm QM1 | Moderate replay |
| Immediate | endmqm -i QM1 | Longer replay; indoubt risk |
| OS kill | kill -9 process | Worst case recovery |
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.
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.
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 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.
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.
endmqm is telling everyone in the mail building to finish their desk and turn off the lights before the building sleeps.
Stop lab QM with endmqm -w; note dspmq and time next strmqm.
Compare AMQERR after immediate versus controlled stop.
Write maintenance ticket template listing steps before endmqm.
1. endmqm is used to:
2. Immediate endmqm increases:
3. endmqm versus dltmqm:
4. Before production endmqm: