Mainframe Path Start learning free
Core9 min readLesson 1 of 4

Why messaging exists

IBM MQ lets one program put a message on a queue and carry on, while another program picks it up when it is ready. Neither has to be running at the same moment, and MQ makes sure the message is neither lost nor delivered twice.

The problem MQ solves

Imagine a mobile banking app that needs to tell the mainframe about a payment. If the app called the mainframe program directly and waited, every slowdown or restart on the mainframe would freeze the app. With messaging, the app puts a message on a queue manager's queue and gets an acknowledgement. The mainframe program reads it when it is ready.

Synchronous call versus messaging
Direct call
Both sides must be up at the same timeCaller waits for the answerA slow receiver slows the callerRetry logic lives in every application
Through MQ
Sender and receiver run independentlySender continues once MQ accepts the messageMessages wait safely on the queue during outagesMQ handles delivery and retry between systems

What a message is

A message has two parts: a message descriptor (the MQMD), which holds control information such as the message ID, correlation ID, priority, persistence and where replies should go, and the application data, which MQ does not look inside. The data might be a fixed COBOL record, JSON or XML: that is agreed between the two applications.

Assured delivery

SettingWhat happensTypical use
PersistentMQ logs the message, so it survives a queue manager restartPayments, orders, anything that must not be lost
Non-persistentKept in memory; faster, but lost if the queue manager stopsEnquiries that can simply be asked again

Persistent messages put inside a unit of work are delivered once and once only: the message either arrives and the receiver's database update commits, or both are backed out together.

Two messaging styles

Common mistakes

Thinking a message is the same as a database record

A queue is a hand-off point, not a store. Messages are meant to be consumed. If a queue keeps growing, something downstream is wrong.

Sending important data as non-persistent

Non-persistent messages are lost if the queue manager restarts. Anything financial or hard to recreate should be persistent and processed under syncpoint.

Assuming MQ understands the data

MQ moves bytes. Both sides must agree the layout, code page and encoding. Many 'MQ problems' are really data-format problems.

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
Queue managers, queues and channels →