MQPMO

Put Message Options (MQPMO) tell IBM MQ how each MQPUT should behave beyond the raw bytes in MQMD. The same queue and descriptor can participate in a transaction or auto-commit immediately; can receive a queue-manager-generated MsgId or preserve one you supply; can pass identity context for audit or hide the real user; can respect logical message grouping for segmented payloads. Beginners often ignore MQPMO and use MQPMO_DEFAULT, then wonder why messages roll back on disconnect or why duplicates appear after retry. Operations teams debugging syncpoint hangs start with whether producers used MQPMO_SYNCPOINT without matching MQCMIT. This tutorial explains initializing MQPMO, combining option flags, syncpoint interaction with databases, identity and authority context options, NEW_MSG_ID and NEW_CORREL_ID, logical order and grouping, quiesce and fail options, MQPUT1, and comparison tables against MQGMO for symmetric get behavior.

Initializing MQPMO

Start with MQPMO_DEFAULT before each put in loops—reusing a structure from a previous put can leave stale Options bits. Set Options field by OR-ing MQ constants. Version field must match structure level expected by your client library version.

c
1
2
3
4
5
6
7
8
MQPMO pmo = {MQPMO_DEFAULT}; pmo.Options = MQPMO_NO_SYNCPOINT | MQPMO_NEW_MSG_ID | MQPMO_NEW_CORREL_ID | MQPMO_FAIL_IF_QUIESCING; MQPUT(Hconn, Hobj, &md, &pmo, buflen, buffer, &compCode, &reason);
MQPMO options explained
OptionEffectContrast
MQPMO_SYNCPOINTPut under current UOWVersus NO_SYNCPOINT immediate commit path
MQPMO_NO_SYNCPOINTPut outside syncpoint when allowedDefault for many fire-and-forget apps
MQPMO_NEW_MSG_IDQM assigns MsgIdOmit if app sets unique MsgId
MQPMO_NEW_CORREL_IDQM assigns CorrelIdRequest/reply often sets CorrelId manually
MQPMO_SET_IDENTITY_CONTEXTPass user identity in MDNeeds authority; audited
MQPMO_PASS_IDENTITY_CONTEXTPropagate context from messageUsed in forwarding chains
MQPMO_LOGICAL_ORDERGroup segments in orderAdvanced segmented messages
MQPMO_FAIL_IF_QUIESCINGFail put during quiescePair with consumer FAIL_IF_QUIESCING

Syncpoint Semantics

MQPMO_SYNCPOINT enrolls the put in the connection's unit of work. Until MQCMIT, other consumers typically do not see the message (visibility rules per platform and get options). MQBACK removes the put. Database + MQ single UOW requires XA or container-managed transactions—plain SYNCPOINT without coordination still helps all-MQ batch steps. Mixed NO_SYNCPOINT puts and SYNCPOINT puts in one program require clear design—accidental auto-commit of half the steps breaks atomicity.

Explainer: How the Clerk Handles Your Letter

MQPMO is instructions to the clerk: put this letter in the pending tray until the manager approves the batch (SYNCPOINT), assign a tracking number automatically (NEW_MSG_ID), or refuse new letters if the office is closing (FAIL_IF_QUIESCING).

Identity Context Options

SET_IDENTITY_CONTEXT writes UserIdentifier and related MQMD fields from the putting application when permitted—useful when a gateway represents many users. PASS_IDENTITY_CONTEXT forwards context from an incoming message to an outbound put. Authority checks prevent spoofing. Wrong use causes 2035 or messages attributed to wrong audit user.

Logical Order and Segmentation

Large payloads split into multiple puts with MQMF_MSG_IN_GROUP and MQMF_LAST_MSG_IN_GROUP in MsgFlags (MQMD), combined with MQPMO_LOGICAL_ORDER so the queue manager preserves order within the group. Middleware and file transfer scenarios use this; simple JSON producers rarely need it. Misconfigured flags produce partial messages consumers cannot reassemble.

MQPUT1

MQPUT1 opens implicitly, puts once, closes—same MQPMO. Useful for stateless HTTP handlers that cannot hold Hobj across requests. Overhead of repeated open per message may matter at extreme throughput—benchmark versus long-lived Hobj.

Interaction with MQMD

NEW_MSG_ID clears application-supplied MsgId and replaces after put—read back MsgId from MQMD output. Persistence and Priority remain in MQMD, not PMO. Report and feed back options cross both structures for advanced COA/COD—see IBM reference for Report field in MQMD with PMO report flags on some APIs.

Common Reason Codes on Put

  • 2053 — queue full; not PMO related.
  • 2035 — authority; context options may trigger.
  • 2014 — wrong open options for put type.
  • 2195 — object does not support put.
  • 2162 — syncpoint not available (MQRC_FUNCTION_NOT_SUPPORTED).

Explain Like I'm Five: MQPMO

MQPMO is telling the mail clerk whether to wait for your parent to say okay before mailing (syncpoint), or to mail right away.

Practice Exercises

Exercise 1

Design a two-put batch: both SYNCPOINT, one CMIT—what happens on BACK after first put only?

Exercise 2

When would you omit NEW_MSG_ID?

Exercise 3

Add FAIL_IF_QUIESCING to producer shutdown story during endmqm.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. MQPMO_SYNCPOINT means:

  • Put waits for commit
  • Put never logs
  • Delete queue
  • Start listener

2. MQPMO_NEW_MSG_ID:

  • QM generates MsgId
  • Deletes message
  • Opens channel
  • Sets MAXDEPTH

3. NO_SYNCPOINT on put:

  • Auto-commit style put
  • Always rolls back
  • Disables MQMD
  • Requires XA only

4. FAIL_IF_QUIESCING helps:

  • Graceful shutdown
  • Increase depth
  • Bypass TLS
  • Format disk
Published
Read time20 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation