SHARE

The SHARE attribute decides whether more than one application can read from a queue at the same time using shared get access. Horizontal scaling—ten Java consumers all draining ORDERS.IN—requires SHARE(ENABLED) on the queue and MQOO_INPUT_SHARED (or equivalent) on MQOPEN. SHARE(DISABLED) enforces exclusive consumer patterns needed by some legacy programs that assume they alone own the queue. Misconfiguration produces MQOPEN failures when the second instance starts, or worse, hidden serialization that negates your scale-out investment. This page explains ENABLED versus DISABLED, open options, competing consumers versus exclusive reader, relation to z/OS queue sharing (different concept), and troubleshooting share conflicts.

SHARE(ENABLED) vs SHARE(DISABLED)

SHARE values
SHAREConcurrent gettersPattern
ENABLEDMultiple (shared open)Competing consumers
DISABLEDExclusiveSingle reader / legacy

Competing Consumers Pattern

Ten identical consumer instances each MQOPEN with input shared, MQGET with wait. Messages distribute across instances—each message to one consumer. Throughput scales roughly with instance count until CPU, disk, or get contention limits gains. Kubernetes replicas and mainframe parallel batch jobs use the same idea. TRIGGER(DEPTH) can start more instances when SHARE(ENABLED) allows parallel get.

shell
1
2
3
4
5
DEFINE QLOCAL('ORDERS.IN') REPLACE + SHARE(ENABLED) GET(ENABLED) PUT(ENABLED) + MAXDEPTH(500000) DEFPSIST(YES) * Application: MQOPEN with MQOO_INPUT_SHARED * Second instance must also use shared open - not exclusive

Open Options: Shared vs Exclusive

MQOO_INPUT_SHARED requests shared access; MQOO_INPUT_EXCLUSIVE requests exclusive access. Queue SHARE must align: exclusive open to SHARE(ENABLED) queue may fail or behave per platform rules. Application frameworks often hide open options—verify Spring JMS, Quarkus, and COBOL connection settings when scaling instances. Second instance failing at startup is the classic SHARE mismatch symptom.

SHARE Is Not z/OS Queue Sharing

IBM MQ queue sharing groups (QSG) let multiple queue managers access coupling facility shared queues—a different feature from the SHARE attribute on a queue definition. The queue-sharing tutorial covers QSG. Here SHARE means object attribute for concurrent application getters on one queue manager (or member). Both terms say “share” but address different layers—do not confuse them in architecture reviews.

SHARE on Model and Reply Queues

Dynamic reply queues from QMODEL often use SHARE(ENABLED) when only one client owns the reply queue—exclusive is also valid for single-threaded clients. Request queues for competing consumers use SHARE(ENABLED). Match model SHARE to client concurrency design.

When SHARE(DISABLED) Is Correct

  • Legacy program documented as sole consumer.
  • Maintenance tool requiring exclusive browse/get.
  • Short-term diagnostic exclusive lock (re-enable after).
  • Vendor software that fails on shared open—check vendor doc.

Troubleshooting

Second consumer MQOPEN fails: compare SHARE, open options, and whether first consumer holds exclusive browse. Throughput flat with many instances: instances may serialize on one queue partition, poison message blocking get, or SHARE(DISABLED). DISPLAY QSTATUS OPROCS IPSPROCS shows open handles—interpret per IBM guide for your release.

Explain Like I'm Five: SHARE

SHARE(ENABLED) means many workers can take tickets from the same line at once—each ticket goes to only one worker. SHARE(DISABLED) means only one worker is allowed at the ticket window at a time.

Practice Exercises

Exercise 1

Design DEFINE QLOCAL for 8 competing consumers on WORK.Q.

Exercise 2

Second instance fails MQOPEN. List SHARE, open option, and first instance checks.

Exercise 3

Explain difference between SHARE attribute and z/OS queue sharing group.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. SHARE(ENABLED) supports:

  • Multiple concurrent getters
  • Duplicate same message to all
  • No MQGET
  • Only channels

2. Competing consumers need typically:

  • SHARE(ENABLED) and GET(ENABLED)
  • PUT(DISABLED)
  • USAGE XMITQ
  • No MAXDEPTH

3. SHARE(DISABLED) implies:

  • Exclusive get access pattern
  • Unlimited depth
  • Pub/sub only
  • No authority

4. MQOO_INPUT_SHARED relates to:

  • Shared get opens
  • TLS
  • Topic strings
  • JCL
Published
Read time14 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation