Chapter 19 Quiz: IBM MQ for COBOL

Instructions: Select the best answer for each question. Each question has exactly one correct answer unless otherwise noted.


Question 1

What is the primary difference between temporal decoupling and spatial decoupling in the context of MQ messaging?

A) Temporal decoupling means messages are encrypted; spatial decoupling means they are not B) Spatial decoupling means sender and receiver don't need to know each other's location; temporal decoupling means they don't need to operate at the same time C) Temporal decoupling applies to batch programs; spatial decoupling applies to CICS programs D) Spatial decoupling requires shared queues; temporal decoupling requires clustered queues

Answer: B Explanation: Spatial decoupling removes the need for sender and receiver to know each other's physical location — MQ handles routing through queue definitions and channels. Temporal decoupling goes further: the sender can put a message at 2:00 PM and the receiver can get it at 6:00 AM the next day. Neither needs to be running at the same time. This is the chapter's threshold concept.


Question 2

Which queue type physically stores messages that are in transit to another queue manager?

A) Remote queue B) Alias queue C) Transmission queue D) Model queue

Answer: C Explanation: A transmission queue is a special local queue (USAGE(XMITQ)) that holds messages destined for another queue manager until the channel initiator sends them. A remote queue definition is just a pointer — it contains no data. When you put a message to a remote queue, MQ actually puts it on the associated transmission queue.


Question 3

A COBOL program calls MQGET and receives completion code MQCC-FAILED with reason code 2033. What does this mean?

A) The message was too large for the buffer B) The program is not authorized to read from the queue C) No message was available within the wait interval D) The queue manager is shutting down

Answer: C Explanation: Reason code 2033 (MQRC-NO-MSG-AVAILABLE) means the wait interval expired without a message being available. This is not an error — it's a normal condition that indicates the queue is empty (or has no messages matching the selection criteria). The program should handle this as a normal exit condition from its get loop.


Question 4

In a request/reply pattern, how does the sender retrieve the correct reply from the reply queue when multiple concurrent request/reply pairs are in flight?

A) By checking the message priority B) By matching the reply's correlation ID to the original request's message ID C) By using MQGET with MQGMO-BROWSE-FIRST D) By opening the reply queue with MQOO-INPUT-EXCLUSIVE

Answer: B Explanation: The sender saves the message ID of its request. The receiver copies the request's message ID into the MQMD-CORRELID field of the reply. The sender then does an MQGET specifying that correlation ID, which retrieves only the matching reply. This is the standard MQ correlation mechanism.


Question 5

What happens when you specify MQPMO-SYNCPOINT on an MQPUT call in a CICS program?

A) The message is immediately visible to consumers B) The put operation becomes part of the CICS unit of work and is committed only when EXEC CICS SYNCPOINT is issued C) The message is written to the MQ log but not to the queue D) The put operation bypasses MQ security checking

Answer: B Explanation: MQPMO-SYNCPOINT makes the MQPUT part of the current unit of work. In CICS, this means the message is not visible to consumers until the CICS task issues EXEC CICS SYNCPOINT. If the task rolls back (EXEC CICS SYNCPOINT ROLLBACK or task abend), the message is removed from the queue. This enables atomic coordination of MQ operations with DB2 updates.


Question 6

A queue is defined with BOTHRESH(3) and BOQNAME(APP.BACKOUT). A consumer program gets a message, attempts to process it, and the processing fails causing a rollback. After how many total processing failures will the message be eligible for routing to the backout queue?

A) 1 B) 2 C) 3 D) 4

Answer: C Explanation: BOTHRESH(3) means the backout threshold is 3. Each time the message is rolled back, MQ increments the message's backout count. When the count reaches 3, the consumer program should detect this (by checking MQMD-BACKOUTCOUNT) and route the message to the backout queue. Note: MQ does not automatically move the message — the application must check the count and perform the routing.


Question 7

What is the key difference between CICS Temporary Storage (TS) queues and MQ queues?

A) TS queues are faster but MQ queues support persistence B) TS queues are scoped to a single CICS region; MQ queues support cross-system, cross-platform messaging with triggering and routing C) TS queues use VSAM; MQ queues use DB2 D) TS queues are for batch programs; MQ queues are for online programs

Answer: B Explanation: TS queues are internal to a CICS region — they're scratch pads for intra-transaction and intra-region data sharing. MQ queues are enterprise messaging infrastructure that spans systems, platforms, and time zones. MQ provides triggering, routing, persistence, transactional coordination, and clustering — none of which TS queues offer. Use TS queues for local, temporary data; use MQ for integration.


Question 8

In an MQ cluster, what does DEFBIND(NOTFIXED) on a cluster queue accomplish?

A) It makes the queue non-persistent B) It allows MQ to route each message to a different instance of the queue across the cluster, enabling workload balancing C) It prevents the queue from being opened for input D) It makes the queue available to all queue managers regardless of authorization

Answer: B Explanation: DEFBIND(NOTFIXED) means the queue manager is free to choose a different destination instance for each message. This enables round-robin or priority-based workload balancing across multiple queue managers that host the same cluster queue. DEFBIND(OPEN) would fix the destination at MQOPEN time.


Question 9

Which of the following is NOT a valid reason for a message to end up on the dead letter queue?

A) The target queue is full B) The message's expiry time has elapsed C) The target queue does not exist D) The sending program is not authorized to put to the target queue

Answer: B Explanation: Expired messages are simply discarded by MQ during MQGET processing — they are not routed to the DLQ. Messages end up on the DLQ when delivery fails: queue full, queue doesn't exist, authorization failure, message too large for the target queue, queue is PUT-inhibited, etc.


Question 10

A COBOL program puts a message with MQPER-PERSISTENT. What does this guarantee?

A) The message will be delivered within a specific time frame B) The message survives a queue manager restart because it is written to the MQ log C) The message cannot be deleted by any other program D) The message will be delivered exactly once

Answer: B Explanation: Persistent messages are written to the MQ recovery log synchronously. If the queue manager crashes and restarts, persistent messages are recovered from the log. This is the foundation of MQ's guaranteed delivery. The tradeoff is performance — persistent messages require log I/O.


Question 11

In the following MQGET call, what is the effect of setting MQMD-MSGID to MQMI-NONE and MQMD-CORRELID to a specific value?

           MOVE MQMI-NONE        TO MQMD-MSGID
           MOVE WS-SAVED-MSGID   TO MQMD-CORRELID

A) Get the next message in order, ignoring both message ID and correlation ID B) Get a message matching the specified correlation ID, regardless of message ID C) Get a message matching both the specified message ID and correlation ID D) Get the oldest message on the queue

Answer: B Explanation: Setting MQMD-MSGID to MQMI-NONE means "don't filter on message ID." Setting MQMD-CORRELID to a specific value means "only return a message whose correlation ID matches." This is the standard technique for retrieving a reply in a request/reply pattern — you match on the correlation ID (which the replier set from the request's message ID).


Question 12

What happens if a COBOL batch program calls MQPUT under syncpoint, then the program abends before calling MQCMIT?

A) The message is delivered to the queue B) The message is moved to the dead letter queue C) The message is rolled back and does not appear on the queue D) The message remains in an "in-doubt" state until manual resolution

Answer: C Explanation: If the program abends before committing, the unit of work is rolled back. Since the MQPUT was under syncpoint, the put is undone — the message is removed from the queue (or more precisely, it was never made visible). This is the same behavior as a DB2 update under syncpoint that gets rolled back.


Question 13

A queue manager cluster has three members, each hosting an instance of queue PAYMENT.INBOUND. Member A has CLWLPRTY(5), Member B has CLWLPRTY(5), and Member C has CLWLPRTY(1). How does MQ route messages?

A) All messages go to Member A B) Messages are distributed equally across all three members C) Messages are distributed between Members A and B (highest priority); Member C only gets messages if both A and B are unavailable D) Messages are distributed by round-robin across all three, with C receiving fewer

Answer: C Explanation: CLWLPRTY determines which queue instances receive messages. Higher-priority instances are preferred. Members A and B both have priority 5, so they share the workload. Member C with priority 1 only receives messages if both A and B are unavailable. This is a common pattern for primary/DR configurations.


Question 14

In the MQ triggering mechanism for CICS, what is the role of the initiation queue?

A) It stores the actual business messages B) It receives trigger messages from MQ, which the CICS trigger monitor reads to start transactions C) It holds messages that failed to trigger D) It stores the trigger configuration

Answer: B Explanation: When a trigger condition is met (e.g., a message arrives on a triggered queue), MQ puts a trigger message on the initiation queue (SYSTEM.CICS.INITIATION.QUEUE). The CICS MQ trigger monitor (CKTI) continuously reads the initiation queue. When it gets a trigger message, it starts the CICS transaction specified in the process definition. The business message stays on the application queue — the trigger message is just a notification.


Question 15

What is the primary risk of using TRIGTYPE(EVERY) on a high-volume queue in CICS?

A) Messages may be lost B) CICS may be overwhelmed by starting a new transaction for every incoming message, consuming region resources C) The queue manager will shut down D) Messages will be delivered out of order

Answer: B Explanation: TRIGTYPE(EVERY) starts a CICS transaction for every message. On a high-volume queue receiving thousands of messages per second, this could start thousands of concurrent CICS transactions, exhausting the region's MAXTASK limit, storage, and thread capacity. For high-volume queues, TRIGTYPE(FIRST) is more appropriate — it starts one instance that loops to drain the queue.


Question 16

Which MQ feature ensures zero-downtime failover on z/OS, allowing any queue manager in the group to access messages immediately if one queue manager fails?

A) Queue manager clustering B) Shared queues in the Coupling Facility C) Multi-instance queue managers D) Channel failover

Answer: B Explanation: Shared queues store messages in the Coupling Facility (CF), which is accessible by all queue managers in the Queue Sharing Group (QSG). If one queue manager fails, the others can immediately read and write to the shared queues with no failover delay and no message loss. This requires Parallel Sysplex hardware with a Coupling Facility.


Question 17

A developer writes the following code. What is wrong with it?

           CALL 'MQPUT' USING WS-HCONN
                               WS-HOBJ
                               MQMD
                               MQPMO
                               WS-MSG-LENGTH
                               WS-MSG-BUFFER
                               WS-COMPCODE
                               WS-REASON
           ADD 1 TO WS-MSG-COUNT

A) MQPUT requires additional parameters B) The developer does not check COMPCODE/REASON after the MQPUT, so a failure goes undetected C) ADD 1 should be COMPUTE D) MQPUT cannot be called with CALL syntax in COBOL

Answer: B Explanation: The code blindly increments the message count without checking whether the MQPUT succeeded. If the put failed (queue full, connection broken, authorization error), the counter is wrong and the failure is silently ignored. Every MQI call must be followed by a check of WS-COMPCODE and WS-REASON.


Question 18

In a two-phase commit scenario involving CICS, DB2, and MQ, which z/OS component coordinates the commit across all three resource managers?

A) CICS Transaction Manager B) DB2 Lock Manager C) z/OS Resource Recovery Services (RRS) D) MQ Channel Initiator

Answer: C Explanation: z/OS Resource Recovery Services (RRS) is the platform's distributed transaction coordinator. It implements the two-phase commit protocol across multiple resource managers (CICS, DB2, MQ, VSAM RLS). When CICS issues a syncpoint, RRS coordinates with DB2 and MQ to ensure all three either commit or roll back.


Question 19

Pinnacle Health Insurance needs to send the same claim notification to both the member portal and the provider portal. The portals are independent systems that process at different speeds. Which message pattern is most appropriate?

A) Request/reply with two separate requests B) Fire-and-forget datagram to each system C) Publish/subscribe with the portals as subscribers D) A single message to a shared queue that both portals read

Answer: C Explanation: Pub/sub is the natural pattern for one-to-many distribution where each consumer gets a copy. The claims system publishes to a topic; both portals subscribe. They receive independent copies and process at their own speed. Option B could work but requires the sender to know about and explicitly put to each destination queue — adding coupling. Option D is wrong because MQGET is destructive — only one consumer would get each message.


Question 20

A production MQ application has been running for two years. Suddenly, messages start appearing on the backout queue at a rate of 50 per hour. The queue had been empty for the previous six months. What is the most likely category of root cause?

A) MQ software bug B) A deployment changed the message format, and the consumer can't parse the new format C) The queue manager is running out of disk space D) The channel between queue managers went down

Answer: B Explanation: A sudden spike in backout queue messages after a long period of zero almost always indicates that something changed in the message format or the processing logic — typically a deployment. The consumer tries to process the message, fails (parsing error, DB2 column mismatch, etc.), rolls back, retries until the backout threshold, then routes to the backout queue. This is the "canary in the coal mine" pattern described by Lisa Tran at CNB. The first diagnostic step is to check recent deployments.


Scoring Guide

Score Assessment
18–20 Strong MQ understanding. Ready for advanced patterns in Chapter 20.
14–17 Solid foundation. Review sections where you missed questions before proceeding.
10–13 Partial understanding. Re-read Sections 19.3–19.5 and redo the code analysis exercises.
Below 10 Foundational gaps. Re-read the full chapter, work through all Section A and B exercises, then retake.