IBM MQ on z/OS: Architecture, Copybooks & CICS Integration
Technical deep-dive into IBM MQ for z/OS. Learn about MSTR/CHINIT address spaces, COBOL copybooks (MQMD, MQPMO), CICS adapters, and Sysplex Queue Sharing Groups.
IBM MQ on z/OS
Architecture · Copybooks · CICS & Batch Integration
A comprehensive technical deep-dive into IBM MQ for z/OS — covering queue manager architecture, address spaces, MQI programming with COBOL copybooks, CICS adapter integration, and batch processing patterns.
IBM MQ for z/OS · Enterprise Messaging Architecture
z/OS Subsystem Overview
How MQ runs as a z/OS subsystem
Queue Manager Architecture
MSTR & CHINIT address spaces
Channel Initiator Deep Dive
MCAs, listeners, TLS tasks
Queue Sharing Groups
Sysplex & coupling facility
MQI Copybooks Explained
CMQC, CMQMD, CMQPMO, CMQGMO
CICS Integration
Adapter, bridge, CKTI trigger monitor
Batch Processing Patterns
JCL, COBOL MQPUT/MQGET
Security & Best Practices
RACF, CHLAUTH, TLS on z/OS
IBM MQ for z/OS · Enterprise Messaging Architecture
01
z/OS Subsystem Overview
MQ runs as a named z/OS SUBSYSTEM
— started at IPL via the subsystem name table
Each Queue Manager has a unique 4-character name (e.g. CSQ1)
— this name is used for all MQSC commands and dump analysis
Queue managers are started
via JCL procedures or operator START commands
MQ libraries include:
SCSQLOAD (load modules), SCSQAUTH (authorization), SCSQCOB (COBOL copybooks), SCSQPROC (sample JCL)
Data persistence uses PAGE SETS (VSAM datasets)
or Db2 tables for object/message storage
LOGS — active and archive —
are critical for restart and recovery after failures
IBM MQ for z/OS · Subsystem Overview
02
Queue Manager Architecture
Single CHINIT per Queue Manager — runs in same z/OS image
MSTR owns all MQ objects; CHINIT executes channel instances
64-bit MEMLIMIT: IBM recommends minimum 3GB for queue managers
Core control blocks & transactional integrity
Logging & recovery functions
MQ object ownership (queues, channels, topics)
API processing for application MQI calls
Command processing (MQSC)
Startup, init parameters & termination logic
Storage: 24-bit, 31-bit, 64-bit areas
Message Channel Agents (MCAs)
Inbound/outbound channel management
TCP/IP interface layer
TLS encryption/decryption tasks
Listener processes (inbound connections)
Channel supervisor process
IBM MQ for z/OS · Enterprise Messaging Architecture
Channel Initiator (CHINIT)
CHINIT Address Space
SUPERVISOR
Manages CHINIT lifecycle, restarts failed channels, coordinates channel events
LISTENER
Listens on TCP/IP port (default 1414) for inbound channel connection requests
NAME SERVER
Resolves TCP hostnames to IP addresses for channel endpoints
MCA — Sender
Reads msgs from Transmission Queue → sends over network
MCA — Receiver
Receives msgs from network → puts to local destination queue
TLS TASKS
Handles certificate validation, encryption/decryption, CRL checks — offloads crypto from MCAs
Transmission Queue
Queue Manager
TCP/IP Network
Remote Queue Manager CHINIT
Thousands of concurrent MCA processes (channels) can run in a single CHINIT
TLS key size directly impacts channel start rate — very high strength ≈ 2× slower than high strength
31-bit storage (ECSA) is the primary scaling constraint — ~5KB per logical connection
IBM MQ for z/OS · Deep Dive
04
Queue Sharing Groups & Sysplex
LPAR 1
LPAR 2
QUEUE MANAGER CSQ1
QUEUE MANAGER CSQ2
XCF Cross-System Coupling
High Availability
If CSQ1 fails, CSQ2 continues serving shared queues flawlessly.
Workload Balancing
Client connections distributed smoothly across multiple QMs.
Shared Queue Access
Messages in CF are accessible from any queue manager in the QSG.
CHINIT per QM
Each queue manager retains its own channel initiator address space.
IBM MQ for z/OS · Enterprise Messaging Architecture
MQI Copybooks — COBOL Definitions
05
CMQC
Main MQI constants, option flags & reason codes
MQOO_INPUT_SHARED, MQOO_OUTPUT
— open options
MQPMO_SYNCPOINT, MQPMO_NO_SYNCPOINT
MQGMO_WAIT, MQGMO_NO_WAIT, MQGMO_CONVERT
MQCC_OK, MQRC_NONE, MQRC_NO_MSG_AVAILABLE
Used in: ALL MQ COBOL programs
CMQMD / CMQMDV
Message Descriptor — metadata for every message
MsgId
— unique message identifier (24 bytes)
CorrelId
— correlation identifier for request/reply
Format
— MQFMT_STRING, MQFMT_NONE, MQFMT_PCF
Persistence
— MQPER_PERSISTENT / NON_PERSISTENT
Priority, Expiry, CodedCharSetId, Encoding
PutDate, PutTime
— timestamp of message put
Use CMQMDV (versioned) — ensures new fields available
CMQPMO / CMQPMOV
Put Message Options — controls MQPUT behavior
MQPMO_SYNCPOINT
— puts within unit of work
MQPMO_NO_SYNCPOINT
— immediate, no UoW
MQPMO_FAIL_IF_QUIESCING
— fail if QM shutting down
MQPMO_LOGICAL_ORDER
— message grouping order
Context options
— for security propagation
CMQGMO / CMQGMOV
Get Message Options — controls MQGET behavior
MQGMO_WAIT + WaitInterval
— blocking get with timeout
MQGMO_SYNCPOINT
— get within unit of work (recommended)
MQGMO_CONVERT
— auto CCSID/encoding conversion
MQGMO_BROWSE_FIRST / BROWSE_NEXT
— non-destructive browse
MQGMO_LOCK / UNLOCK
— temporary message locking
CMQCFC
PCF (Programmable Command Format) constants
MQCMD_INQUIRE_Q, MQCMD_CHANGE_Q_MGR
— admin commands
Sent to SYSTEM.ADMIN.COMMAND.QUEUE
via MQPUT
Responses read via MQGET
on reply queue
Used for:
in-band administration & monitoring
IBM MQ for z/OS · Enterprise Messaging Architecture
05b
COBOL MQI Program Structure
IBM MQ for z/OS · Enterprise Messaging Architecture
06
CICS Integration — The MQ Adapter
CICS-MQ Adapter
CICS-MQ Bridge (MQCIH)
CKTI Trigger Monitor
IBM MQ for z/OS · Enterprise Messaging Architecture
06b
CICS-MQ Message Flow Patterns
Inbound Request Pattern (CKTI-triggered)
Trigger fires when message arrives. CKTI starts CICS transaction. Transaction MQGETs and processes. MQCMIT to confirm.
Outbound Request Pattern (CICS → MQ → Batch)
Async decoupling. CICS puts and commits immediately. Batch picks up asynchronously. Correlation via MQMD.CorrelId.
MQCIH Structure
IBM MQ for z/OS · Enterprise Messaging Architecture
07
Batch MQ Processing on z/OS
JCL Setup for Batch MQ Programs
Batch Processing Patterns
IBM MQ for z/OS · Batch Processing
07b
Key Copybook Structure Field Reference
MQMD — Message Descriptor
MQPMO — Put Message Options
MQGMO — Get Message Options
IBM MQ for z/OS · Field Reference Guide
08
Security on IBM MQ for z/OS
RACF
MSTR
QUEUE MANAGER
CHINIT
CICS Region
Batch Job
Ext. Client / Channel
RACF Integration
<div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Queue manager runs under a dedicated RACF User ID</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">MQ uses RACF to control access to: Queues, QMGRs, Processes, Namelists, Topics</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">RACF resource classes: MQQUEUE, MQCMDS, MQADMIN</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Each CICS region and batch job connects under its own RACF ID</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">In multilevel-secure environments: separate QMs per security classification</span></div>
CHLAUTH Rules
<div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Channel Authentication Records control which connections are allowed</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Blocks all channel connections by default — explicit rules required</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Match on: channel name, client IP address, SSLPEER (TLS certificate DN)</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Actions: ALLOW, BLOCK, or MAP to a specific MCAUSER</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Replaces deprecated SSLPEER and MCAxxx channel attributes</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">SET CHLAUTH command managed seamlessly via MQSC</span></div>
TLS on z/OS Channels
<div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">TLS configured per channel via SSLCIPH attribute</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">z/OS uses SAF Keyring (RACF) to store certificates — no file-based keystores</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">SSLKEYR = 'user/keyring-name' defined in CHINIT startup parameters</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Modern TLS 1.2 / TLS 1.3 natively supported (MQ 9.2+)</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">CRL checking achieved via optimized OCSP or LDAP lookups</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Key strength impacts performance: Very High Strength ≈ 2× slower channel start</span></div>
CONNAUTH — App Authentication
<div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">CONNAUTH defines how applications explicitly authenticate to the queue manager</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Can strictly require USERID + PASSWORD on MQCONN/MQCONNX call</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Maps directly to RACF user validation (MQCSP structure in MQCONNX)</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Prevents any anonymous fallback connections from generic batch or CICS apps</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">ADOPTMCA attribute on channels allows for dynamic MCA identity adoption</span></div><div style="display:flex; align-items:flex-start;"><span style="color:#2ecc71; margin-right:12px; font-size:20px; line-height:1.2;">•</span><span style="flex:1;">Enforced audit trail: all authentication events logged safely via SMF 115</span></div>
z/OS Messaging Security · Enterprise Architecture
Storage & Performance Tuning
5 KB
<strong style="color: #e8e8e8;">ECSA per concurrent logical connection.</strong> Formula: Max Connections × 5KB = ECSA requirement
3 GB+
<strong style="color: #e8e8e8;">Minimum MEMLIMIT recommended</strong> for queue manager 64-bit storage. Formula: 2GB + Total Buffer Pool sizes
5,522
<strong style="color: #e8e8e8;">Maximum SVRCONN channels</strong> in MQ 9.4 CHINIT test before hitting 80% of 31-bit storage limit
<strong style="color: #ffffff;">SQA/CSA</strong> — legacy, very limited, avoid if possible
<strong style="color: #ffffff;">ECSA</strong> — ~5KB/connection. Primary scaling constraint for CHINIT channels
<strong style="color: #ffffff;">MEMLIMIT</strong> — buffer pools, structure backups. Set MEMLIMIT=3G minimum
<strong style="color: #ffffff;">VSAM datasets</strong> — store MQ objects and message data. Num 0 to 100
<strong style="color: #ffffff;">Active & Archive logs</strong> — set Log Buffer Size for high throughput
<strong style="color: #ffffff;">Set MEMLIMIT explicitly</strong> — never use NOLIMIT. Calculate: 2GB + buffer pool sizes + 500MB for RECOVER CFSTRUCT
<strong style="color: #ffffff;">Use LOCATION(ABOVE)</strong> for all buffer pools to avoid 31-bit storage pressure
<strong style="color: #ffffff;">Limit SVRCONN channels</strong> — monitor 31-bit storage with SMF 115 Class 3 trace (ACELIM)
<strong style="color: #ffffff;">Log buffer sizing</strong> — large log buffers reduce I/O. Use DSNAOINI parameters for log performance
<strong style="color: #ffffff;">TLS tradeoffs</strong> — Balance security strength vs. channel start rate. Very High Strength ≈ 50% of High Strength throughput
IBM MQ for z/OS · Storage & Performance Tuning
End-to-End z/OS MQ Architecture
IBM MQ for z/OS · Enterprise Messaging Architecture
Key Takeaways & Best Practices
IBM MQ for z/OS — Built for enterprise reliability, security and performance at scale
IBM MQ for z/OS · Enterprise Messaging Architecture
Two Address Spaces, One Queue Manager
MSTR owns MQ objects and API processing. CHINIT runs MCAs and handles all network I/O. They must always run together.
Always Use Versioned Copybooks
Use CMQMDV, CMQPMOV, CMQGMOV — not CMQMD/CMQPMO/CMQGMO. Versioned copybooks ensure new fields are accessible and Version is set correctly.
SYNCPOINT is Non-Negotiable for Critical Data
Always use MQPMO_SYNCPOINT + MQGMO_SYNCPOINT + MQCMIT for business-critical messages. On abend/disconnect, QM automatically backs out.
CSQCSTUB is Your Link to MQ in Batch & CICS
Link CSQCSTUB into COBOL programs for z/OS batch. Include SCSQLOAD in STEPLIB. In CICS, include in DFHRPL.
CHLAUTH — Default Deny, Explicit Allow
All MQ channels blocked by default. Define explicit CHLAUTH rules for each application. Map to specific MCAUSER RACF IDs.
ECSA: 5KB per Connection — Plan Ahead
Each logical connection costs ~5KB of ECSA. Max connections × 5KB = your ECSA requirement. Monitor with SMF 115 statistics.
MEMLIMIT Must Be Explicit
Never use NOLIMIT. Set MEMLIMIT = 2GB + buffer pool sizes, minimum 3GB. Add 500MB if using RECOVER CFSTRUCT.
CKTI Triggers Async CICS Processing
Use MQMONITOR + CKTI for event-driven CICS. MQ triggers start CICS transactions when messages arrive. CKAM throttles under WLM pressure.
TLS Keyring — Not Files — on z/OS
Use SAF Keyrings (RACF) for TLS certificates. No file-based keystores. SSLKEYR='user/keyring'. TLS 1.3 supported in MQ 9.2+.
Queue Sharing Groups for HA
QSGs with Coupling Facility provide active/active HA across LPARs. If one QM fails, others access shared queues. Each QM retains its own CHINIT.
- ibm-mq
- zos
- mainframe
- cobol
- cics
- enterprise-messaging
- sysplex
- middleware