# 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.

Tags: ibm-mq, zos, mainframe, cobol, cics, enterprise-messaging, sysplex, middleware
## IBM MQ on z/OS Subsystem Overview
* MQ runs as a named z/OS subsystem starting at IPL.
* Each Queue Manager has a 4-character name (e.g., CSQ1).
* Data persistence uses VSAM Page Sets and Active/Archive Logs for recovery.

## Queue Manager Architecture (MSTR & CHINIT)
* **MSTR Address Space**: Owns MQ objects (queues, topics), handles API processing, and manages transactional integrity.
* **CHINIT Address Space**: Executes channel instances (MCAs), manages listeners, and handles TLS encryption/decryption.
* Memory: IBM recommends a minimum 3GB MEMLIMIT for 64-bit storage.

## Queue Sharing Groups (QSG)
* Enables high availability across Parallel Sysplex LPARs.
* Messages are stored in the Coupling Facility (CF) for shared access.
* If one QM fails, others in the QSG continue to serve shared queues.

## MQI Copybooks for COBOL
* **CMQC**: Main constants and reason codes.
* **CMQMDV**: Versioned Message Descriptor (MsgId, CorrelId).
* **CMQPMOV**: Put Message Options (includes SYNCPOINT control).
* **CMQGMOV**: Get Message Options (WaitInterval, Convert, Browse).

## CICS & Batch Integration
* **CICS-MQ Adapter**: Uses DFHMQTRU (TRUE) for threadsafe RMI connection.
* **CKTI Trigger Monitor**: Starts CICS transactions based on initiation queue triggers.
* **Batch Patterns**: Programs link-edit CSQCSTUB to resolve MQI calls; uses JCL with SCSQLOAD in STEPLIB.

## Security & Performance Tuning
* **RACF**: Controls access to queues and commands via MQQUEUE and MQADMIN classes.
* **CHLAUTH**: Implements a 'default deny' security posture for channels.
* **TLS**: Uses SAF Keyrings (RACF) for certificates rather than file-based keystores.
* **Performance**: ECSA usage is ~5KB per logical connection; buffer pools should use LOCATION(ABOVE).
---
This presentation was created with [Bobr AI](https://bobr.ai) — an AI presentation generator.