Screen Handling: CICS & Interactive COBOL Basics

COBOL Intermediate/Advanced

Chapter 7 · Screen Handling: CICS & Interactive COBOL Basics

Every real program across both courses so far has been batch — no human involved while it runs. CICS is the real online counterpart: a genuine transaction-processing system letting a COBOL program respond directly to someone sitting at a real terminal.

What CICS Genuinely Is

CICS traces to a real 1966 joint project with Michigan Bell, publicly announced in 1968 as "Public Utility Customer Information Control System," and formally released as a general IBM product on 8 July 1969. Its whole real purpose is online transaction management — high-volume, screen-oriented processing, genuinely distinct from everything batch-related covered so far in this course.

EXEC CICS: The Same Real Embedded-Command Style

Real CICS commands sit inside COBOL source exactly like Chapter 4's own embedded SQL — EXEC CICS/END-EXEC, processed by a genuine translator before the real COBOL compiler ever sees the source:

EXEC CICS SEND MAPSET('CUSTSET') MAP('CUSTMAP') END-EXEC.

SEND MAP / RECEIVE MAP: Real Screen I/O

A real CICS screen is defined separately as a BMS (Basic Mapping Support) map. RECEIVE MAP pulls whatever the user just typed into a COBOL structure; SEND MAP pushes new content back out to the real terminal:

EXEC CICS RECEIVE MAP('CUSTMAP') MAPSET('CUSTSET') INTO(CUSTOMER-SCREEN) END-EXEC. MOVE CUST-ID-FIELD OF CUSTOMER-SCREEN TO WS-CUST-ID. EXEC SQL SELECT CUST_NAME INTO :WS-CUST-NAME FROM CUSTOMER WHERE CUST_ID = :WS-CUST-ID END-EXEC. MOVE WS-CUST-NAME TO CUST-NAME-FIELD OF CUSTOMER-SCREEN. EXEC CICS SEND MAP('CUSTMAP') MAPSET('CUSTSET') FROM(CUSTOMER-SCREEN) END-EXEC.

Pseudo-Conversational: A Genuinely Distinctive Real Design

A CICS transaction genuinely does not sit waiting for the user's next keystroke the way a simple interactive program might. Instead, after sending a screen out, it ends completely:

EXEC CICS RETURN TRANSID('CUST') COMMAREA(WS-COMM-AREA) END-EXEC.
Why Ending Completely Is the Real Point, Not a Limitation A real RETURN releases every resource the transaction was holding — memory, database connections, everything — the instant a screen goes out to the terminal. Whatever real time the human spends reading it and deciding what to type next costs the mainframe genuinely nothing, since no program is sitting idle waiting on them. When the user does respond, CICS starts a genuinely fresh instance of the same transaction from scratch, named by the real TRANSID the previous instance specified.

COMMAREA: Carrying State Across Separate Instances

Since each screen is handled by a genuinely new, fresh transaction instance with none of the previous instance's own working storage still around, real state has to be carried forward explicitly. The COMMAREA (communication area) is exactly that — a real data area RETURN hands off, which the next instance receives back automatically, letting a multi-screen real business process continue correctly across what are, underneath, entirely separate program executions.

Hands-On Exercises

Exercise 1

Using this chapter's own real material, explain in your own words why CICS's own pseudo-conversational design — ending the transaction completely after every screen — is genuinely more efficient for serving thousands of simultaneous terminal users than a program that simply waits for the next keystroke while remaining active.

📄 View solution
Exercise 2

Using this chapter's own real material, explain in your own words why a value stored only in an ordinary WORKING-STORAGE field during one CICS transaction instance would genuinely be lost by the time the user's next screen response triggers a new instance, and what COMMAREA does differently.

📄 View solution
Exercise 3

Using this chapter's own real customer-lookup example, explain in your own words why EXEC CICS and EXEC SQL are able to sit side by side in the same real PROCEDURE DIVISION code, given what Chapter 4 already established about how embedded SQL is genuinely processed before compilation.

📄 View solution

Chapter 7 Quick Reference

  • CICS — real online transaction processing, formally released 1969, genuinely distinct from every batch topic in this course
  • EXEC CICS ... END-EXEC — real embedded commands, processed by a genuine translator, the same style as Chapter 4's own EXEC SQL
  • SEND MAP / RECEIVE MAP — real screen output/input against a BMS-defined map
  • Pseudo-conversational — a transaction genuinely ends via RETURN after every screen, releasing all resources during real human think-time
  • COMMAREA — the real mechanism carrying state forward from one transaction instance to the genuinely separate next one