Mainframe Path Start learning free
Core11 min readLesson 2 of 4

Queue managers, queues and channels

Everything in MQ belongs to a queue manager. Queues hold messages; channels move them between queue managers. Knowing the handful of object types lets you read any MQ configuration.

The queue manager

A queue manager owns queues and other objects and provides the MQI that applications call. On z/OS it runs as two address spaces: the master (xxxxMSTR), which manages queues, logging and recovery, and the channel initiator (xxxxCHIN), which runs the channels that talk to other queue managers. Queue manager names on z/OS are up to four characters, for example MQP1.

Queue types

ObjectWhat it isExample use
Local queueA real queue that holds messages on this queue managerPAYMENTS.IN read by a CICS program
Remote queue definitionA local name that points at a queue on another queue managerPut to PARTNER.ORDERS and MQ routes it away
Transmission queueA special local queue holding messages waiting to go down a channelMQP2.XMITQ
Alias queueAnother name for a queue or topicLets you repoint applications without changing code
Model queueA template from which dynamic queues are createdTemporary reply queues
Dead-letter queueWhere MQ puts messages it cannot deliverSYSTEM.DEAD.LETTER.QUEUE or a site-named DLQ

How a message reaches another system

Sending to a queue on another queue manager
MQPUTto remote queue def
XMITQtransmission queue
Sender channelMQP1 CHIN
Receiver channelMQP2 CHIN
Local queueon MQP2

Channels are one-way and come in matching pairs. A sender channel on one side talks to a receiver channel of the same name on the other. Client applications on servers connect through a server-connection (SVRCONN) channel instead of having their own queue manager.

Triggering

A program does not have to poll a queue all day. With triggering, MQ writes a trigger message to an initiation queue when work arrives, and a trigger monitor starts the right program. In CICS the supplied trigger monitor is the CKTI transaction, which starts the CICS transaction named in the process definition.

MQSC: defining a local queue
DEFINE QLOCAL('PAYMENTS.IN') +
       DESCR('Payments from mobile channel') +
       DEFPSIST(YES) MAXDEPTH(100000) +
       BOTHRESH(3) BOQNAME('PAYMENTS.BACKOUT') +
       TRIGGER TRIGTYPE(FIRST) +
       INITQ('CICS01.INITQ') PROCESS('PAYMENTS.PROC')
Reading the definitionWhat it means
DEFPSIST(YES)
Messages default to persistent unless the application says otherwise
MAXDEPTH(100000)
The most messages the queue can hold before puts fail with a 'queue full' reason code
BOTHRESH(3) BOQNAME(...)
Backout threshold and backout queue: a message that keeps failing is moved aside after three attempts (if the application or CICS adapter honours it)
TRIGGER TRIGTYPE(FIRST)
Start the reader when the first message arrives on an empty queue

Common mistakes

Expecting a remote queue definition to hold messages

It is only a pointer. Messages for it wait on the transmission queue until the channel sends them.

Starting only one end of a channel

Channels are pairs. The sender side usually initiates; if the receiver side or network is unavailable the sender goes into RETRYING.

Leaving triggering half-configured

Triggering needs the queue's TRIGGER settings, an initiation queue, a process definition and a running trigger monitor. Miss one and messages just sit there.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Why messaging existsProgramming with the MQI in COBOL →