MQOD

The Object Descriptor (MQOD) answers one question for MQOPEN: which IBM MQ object do you want to use? While MQCONN attaches you to a queue manager, MQOD names the queue, topic, or model that becomes an Hobj handle. Mistyped ObjectName values produce reason 2085 unknown object; wrong ObjectType produces 2042 object type error. Dynamic reply queues depend on MQOD fields the queue manager fills in after open—beginners lose replies because they never read DynamicQName back from the descriptor. Alternate user and object queue manager fields support gateway and cross-queue-manager patterns under strict authority. This tutorial explains each major MQOD field, initialization with MQOD_DEFAULT, opening aliases versus locals, model and dynamic queue flows, topic opens, and how MQOD output differs from input after a successful open.

Initializing MQOD

Always start from MQOD_DEFAULT so reserved fields are zero. Set ObjectType before ObjectName when learning—some samples set both explicitly. Reusing MQOD from a previous open without re-init leaves stale DynamicQName or alternate user fields that cause surprising 2035 authority results.

c
1
2
3
4
5
6
MQOD od = {MQOD_DEFAULT}; od.ObjectType = MQOT_Q; strncpy(od.ObjectName, "ORDERS.IN", MQ_Q_NAME_LENGTH); MQOPEN(Hconn, &od, MQOO_OUTPUT, &Hobj, &compCode, &reason);
MQOD fields for beginners
FieldIn / OutMeaning
ObjectNameInQueue or topic name to open
ObjectTypeInMQOT_Q, MQOT_TOPIC, etc.
ObjectQMgrNameInTarget QM if not connected QM
DynamicQNameOutName created for dynamic queue
AlternateUserIdInOpen as another user if permitted
AlternateSecurityIdInPlatform security id (z/OS)

ObjectName and Naming Rules

Names are case-sensitive on distributed MQ. ORDERS.IN and orders.in differ. Cluster queue names appear as the cluster object name on the connection where you open—resolution uses cluster repository. Alias queue ObjectName is the alias; the queue manager resolves to base queue on put/get. Remote queue names are rarely opened directly by applications; use alias or queue manager default transmission. Length limit 48 characters—interface specs should enforce shorter logical names for readability.

Explainer: Writing the Locker Number on the Form

MQOD is the form you fill at the post office desk saying which locker number you need. ObjectType says whether it is a mailbox locker or a bulletin board (topic). DynamicQName is when they assign you a temporary locker and write the number on the form after you sign up.

Dynamic Queues from Models

Request/reply clients set ObjectName to a model queue such as SYSTEM.DEFAULT.MODEL.QUEUE or a custom QMODEL. Open options include MQOO_INPUT or output per pattern. After MQOPEN succeeds, read DynamicQName—often AMQ.xxx.GUID—and put that into MQMD ReplyToQ for the server. Server MQPUTs the reply to that name on the correct queue manager. Client MQGET on DynamicQName, then MQCLOSE. PERMDYN versus TEMPDYN behavior comes from model DEFTYPE, not from MQOD itself.

ObjectQMgrName

When empty, the object is assumed on the queue manager you connected to. Populating ObjectQMgrName requests open on another queue manager name—used in advanced federated scenarios and some client scenarios. Wrong name causes resolution failure. Most applications leave blank and use aliases for remote destinations instead.

Alternate User

AlternateUserId lets trusted servers act for many end users—payments hub opening as customer ID when AUTHREC and policies allow. Misconfiguration is a security audit finding. z/OS may use AlternateSecurityId for RACF tokens. Failed alternate open returns 2035; successful open attributes puts to the alternate identity in MQMD context fields when options request it.

Topics and MQOD

ObjectType MQOT_TOPIC with topic name or string opens publication or subscription paths per API style. Pub/sub also uses MQSD for subscriptions on some calls—see MQSD tutorial. Distinct from QLOCAL depth queues but same MQOD discipline applies to naming.

MQOD Versus MQMD

MQOD selects the object once at open. MQMD describes each message on put/get. Do not put queue names in MQMD for open—that is MQOD job. ReplyToQ in MQMD is destination for message data, not open descriptor.

Common Errors

  • 2085 — object does not exist; typo or missing DEFINE.
  • 2042 — wrong ObjectType for actual object.
  • 2035 — alternate user or open authority denied.
  • Empty DynamicQName after model open — open failed or wrong model.

Explain Like I'm Five: MQOD

MQOD is the slip of paper that says which mailbox you want to open before the clerk gives you the key.

Practice Exercises

Exercise 1

Write MQOD values to open alias PAYMENTS.ALIAS for output put.

Exercise 2

Describe model queue open flow including which field holds the reply queue name after open.

Exercise 3

When would ObjectQMgrName be non-empty in your architecture?

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. MQOD is passed to:

  • MQOPEN
  • MQDISC only
  • strmqm
  • DISPLAY LSSTATUS

2. ObjectType MQOT_Q means:

  • Queue object
  • Topic only
  • Channel
  • Listener

3. DynamicQName after open contains:

  • Generated queue name
  • Channel cipher
  • Listener port
  • QMGR version

4. ObjectName max length is:

  • 48 characters (IBM MQ rule)
  • 8 characters
  • 256 characters
  • Unlimited
Published
Read time19 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation