Key Takeaways — Chapter 39: Real-Time Integration

Core Concepts

  1. Integration happens at the boundary, not in the business logic. COBOL programs do not need to be rewritten to participate in modern architectures. Only the input/output interfaces change.

  2. IBM MQ enables reliable asynchronous communication. Messages on queues decouple producers and consumers — they do not need to run simultaneously or even on the same platform.

  3. JSON GENERATE and JSON PARSE are native COBOL statements (Enterprise COBOL 6.1+). Use the NAME clause to produce camelCase JSON field names. Use SUPPRESS to omit COBOL-specific fields like DEPENDING ON counters.

  4. XML PARSE uses an event-based model. You provide a processing procedure that handles events like START-OF-ELEMENT, CONTENT-CHARACTERS, and END-OF-DOCUMENT.

  5. COBOL as an API provider works through CICS and z/OS Connect. The COBOL program receives input via COMMAREA and returns output the same way. HTTP/JSON translation is handled by infrastructure.

  6. COBOL as an API consumer uses CICS WEB SEND/RECEIVE or the z/OS Client Web Enablement Toolkit to make HTTP calls to external services.

  7. The request/reply pattern in MQ uses correlation IDs to match responses to their original requests.

  8. Dead letter queues capture unprocessable messages for investigation rather than discarding them.

  9. COMP-3 data must be converted to DISPLAY format before inclusion in JSON or XML. Packed decimal is a binary format that is not valid in text-based data formats.

  10. Connection pooling is essential for performance. CICS handles this automatically; batch programs should open connections once and reuse them.

Integration Patterns Summary

Pattern When to Use Key Technology
REST API (provider) External systems need real-time data z/OS Connect + CICS
REST API (consumer) COBOL needs external data CICS WEB commands
MQ fire-and-forget Notifications, logging MQPUT without reply
MQ request/reply Synchronous messaging MQPUT + MQGET with correlation
Publish/subscribe Multiple consumers for same event MQ Topics
Message listener Continuous message processing MQGET in loop with wait
Dead letter queue Error handling for messages DLQ + retry logic

Common Mistakes to Avoid

  • Sending COMP-3 fields directly in JSON (binary data in text format)
  • Not handling MQRC-NO-MSG-AVAILABLE in message loops (causes spin)
  • Opening new MQ/HTTP connections per request instead of pooling
  • Duplicating business logic in online programs instead of extracting shared subprograms
  • Ignoring character encoding differences (EBCDIC vs. UTF-8)
  • Not setting correlation IDs in request/reply patterns
  • Skipping retry logic for transient integration failures