Skip to content

CICS Transaction Processing — COBOL Programs, BMS Maps, Pseudo-Conversational Programming

DodaTech Updated 2026-06-22 8 min read

In this tutorial, you'll learn about CICS Transaction Processing. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

CICS (Customer Information Control System) is IBM's online Transaction processing (OLTP) monitor for z/OS mainframes — it handles millions of daily transactions at banks, insurance companies, and airlines, processing everything from ATM queries to flight bookings in under a second.

What You'll Learn

CICS region architecture, writing COBOL programs with EXEC CICS commands, BMS mapsets for screen design, transient data and temporary storage queues, pseudo-conversational programming with COMMAREA, and file control operations.

Why It Matters

Most Mainframe transactions — 90% or more — run under CICS. When you withdraw cash from an ATM, check your bank balance online, or book a flight, a CICS Transaction processes your request. CICS handles the complexity of concurrent users, data integrity, and rapid response times so the programmer only writes business logic.

Durga Antivirus Pro applies CICS-style Transaction isolation to ensure that scanning one file cannot interfere with another concurrent scan. Doda Browser uses CICS-inspired pseudo-conversational patterns to maintain state across page loads without keeping expensive connections open.

Real-World Use

An ATM network processes 50,000 transactions per hour across 2,000 machines. Each ATM request — balance inquiry, cash withdrawal, transfer — is a CICS Transaction that runs on a Mainframe. CICS manages 50,000 concurrent tasks, each completing in under 300 milliseconds, with full data integrity and rollback on failure.

Learning Path

flowchart LR
  A["Mainframe Basics"] --> B["COBOL Programming"]
  B --> C["JCL Job Control"]
  C --> D["CICS Transactions
You are here"] D --> E["DB2 for z/OS"] style D fill:#f90,color:#fff

CICS Architecture

A CICS region is an address space running on z/OS that manages online transactions. The region contains multiple components working together.

flowchart TB
  subgraph "CICS Region"
    MCT["Master Terminal"]
    PC["Program Control"]
    FC["File Control"]
    TC["Terminal Control"]
    SC["Storage Control"]
    DC["Temporary Storage & TD Queues"]
  end
  VT["3270 Terminals"] --> MCT
  PC --> P1["Program A"]
  PC --> P2["Program B"]
  MCT --> TC
  FC --> VSAM["VSAM Files"]
  FC --> DB2["DB2 Tables"]

Key CICS Components

Component Function
Master Terminal System management and operator commands
Program Control Manages program loading, linking, and execution
File Control Handles VSAM/BDAM file access with record locking
Terminal Control Manages 3270 terminal I/O
Storage Control Manages CICS working storage and GETMAIN/FREEMAIN
Temporary Storage Named queues for passing data between transactions
Transient Data Intra-system queues and log files

EXEC CICS Commands

CICS extends COBOL with a set of API commands prefixed with EXEC CICS. These commands handle all the system-level work — displaying screens, reading files, managing queues.

Basic Terminal I/O

IDENTIFICATION DIVISION.
       PROGRAM-ID. CICSHELLO.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-MESSAGE      PIC X(50) VALUE 'WELCOME TO CICS'.

       PROCEDURE DIVISION.
       MAIN.
           EXEC CICS SEND TEXT
               FROM(WS-MESSAGE)
               LENGTH(50)
           END-EXEC.
           EXEC CICS RETURN
           END-EXEC.

Expected behavior: The message "WELCOME TO CICS" appears on the terminal screen, then the program returns control to CICS.

Receiving Terminal Input

PROCEDURE DIVISION.
       MAIN.
           EXEC CICS RECEIVE
               INTO(WS-INPUT)
               LENGTH(WS-INPUT-LEN)
           END-EXEC.
           EXEC CICS SEND TEXT
               FROM('YOU TYPED: ')
               FROM-LENGTH(11)
           END-EXEC.
           EXEC CICS SEND TEXT
               FROM(WS-INPUT)
               FROM-LENGTH(WS-INPUT-LEN)
           END-EXEC.
           EXEC CICS RETURN
           END-EXEC.

Expected behavior: The program waits for keyboard input, reads what the user typed, then echoes it back with a prefix.

Pseudo-Conversational Programming

The most important concept in CICS: never hold a conversation open. A pseudo-conversational program does work, sends output, releases the terminal, and waits to be re-invoked when the user presses Enter.

Why Pseudo-Conversational?

  • Conversational — locks the terminal and program until user responds (wasteful of resources)
  • Pseudo-conversational — does work, returns control, releases storage. Next key press re-invokes a new task
sequenceDiagram
  participant U as User
  participant T as Terminal
  participant C as CICS
  participant P as Program
  U->>T: Enter customer ID
  T->>C: Send data to CICS
  C->>P: Start new task
  P->>P: Process request
  P->>T: Display results
  P->>C: RETURN (task ends)
  Note over U: User sees results, enters next input
  U->>T: Press Enter
  T->>C: New task starts
  C->>P: Invoke again

Example: Pseudo-Conversational with COMMAREA

COMMAREA (Communication Area) is a storage area passed between successive invocations of the same program. It holds the current state so the program knows what to do next.

IDENTIFICATION DIVISION.
       PROGRAM-ID. CICSMENU.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-COMMAREA.
          05 WS-STATE        PIC X(01).
             88 WS-STATE-INIT    VALUE 'I'.
             88 WS-STATE-MENU    VALUE 'M'.
             88 WS-STATE-DETAIL  VALUE 'D'.
          05 WS-CUST-ID      PIC X(05).
          05 WS-CUST-NAME    PIC X(30).

       LINKAGE SECTION.
       01 DFHCOMMAREA.
          05 CA-STATE        PIC X(01).
          05 CA-CUST-ID      PIC X(05).
          05 CA-CUST-NAME    PIC X(30).

       PROCEDURE DIVISION.
       MAIN.
           IF EIBCALEN = 0
               MOVE 'I' TO WS-STATE
               PERFORM SHOW-MENU
           ELSE
               MOVE DFHCOMMAREA TO WS-COMMAREA
               EVALUATE WS-STATE
                   WHEN 'M' PERFORM PROCESS-MENU
                   WHEN 'D' PERFORM PROCESS-DETAIL
                   WHEN OTHER PERFORM SHOW-MENU
               END-EVALUATE
           END-IF.

       SHOW-MENU.
           EXEC CICS SEND TEXT
               FROM('1. INQUIRY 2. UPDATE 3. EXIT')
               LENGTH(30)
           END-EXEC.
           MOVE 'M' TO WS-STATE.
           PERFORM RETURN-TO-CICS.

       PROCESS-MENU.
           EXEC CICS RECEIVE INTO(WS-CUST-ID)
               LENGTH(5)
           END-EXEC.
           MOVE 'D' TO WS-STATE.
           PERFORM RETURN-TO-CICS.

       PROCESS-DETAIL.
           EXEC CICS SEND TEXT
               FROM('CUSTOMER DETAIL COMING')
               LENGTH(25)
           END-EXEC.
           EXEC CICS RETURN
           END-EXEC.

       RETURN-TO-CICS.
           EXEC CICS RETURN
               TRANSID('MENU')
               COMMAREA(WS-COMMAREA)
               LENGTH(36)
           END-EXEC.

The key pattern: EXEC CICS RETURN TRANSID('MENU') COMMAREA(...) — this tells CICS to re-invoke this same program with the COMMAREA when the user presses Enter again.

BMS Mapsets

BMS (Basic Mapping Support) defines the screen layout for 3270 terminals. A mapset contains one or more maps.

* BMS map definition (assembled separately)
CUSMAP  DFHMSD TYPE=&SYSPARM, MODE=INOUT, LANG=COBOL, STORAGE=AUTO
CUSDETL DFHMDI SIZE=(24,80)
        DFHMDF POS=(1,1), LENGTH=40, ATTRB=PROT,
               INITIAL='CUSTOMER INQUIRY SYSTEM'
        DFHMDF POS=(3,1), LENGTH=10, ATTRB=PROT,
               INITIAL='CUST ID: '
CUSTID  DFHMDF POS=(3,12), LENGTH=5, ATTRB=UNPROT, NUM
        DFHMDF POS=(4,1), LENGTH=10, ATTRB=PROT,
               INITIAL='NAME:    '
CUSTNAM DFHMDF POS=(4,12), LENGTH=30, ATTRB=UNPROT
        DFHMSD TYPE=FINAL

The assembled map is referenced in the program:

EXEC CICS SEND MAP('CUSDETL')
           MAPSET('CUSMAP')
           FROM(WS-CUSDETL-I)
           ERASE
       END-EXEC.

Transient Data Queues (TDQ/TDQ)

TD queues store messages outside the Transaction for sequential processing — useful for logs, audit trails, and print output.

EXEC CICS WRITEQ TD
           QUEUE('AUDIT')
           FROM(WS-AUDIT-RECORD)
           LENGTH(80)
       END-EXEC.

Temporary Storage Queues (TSQ/TSR)

TS queues store records temporarily within a session — like a shopping cart or multi-page Transaction data.

EXEC CICS WRITEQ TS
           QUEUE('CART-001')
           FROM(WS-ITEM)
           LENGTH(100)
           ITEM(1)
       END-EXEC.

       EXEC CICS READQ TS
           QUEUE('CART-001')
           INTO(WS-ITEM)
           LENGTH(100)
           ITEM(1)
       END-EXEC.

       EXEC CICS DELETEQ TS
           QUEUE('CART-001')
       END-EXEC.

File Control Operations

CICS provides direct file access commands for VSAM files.

EXEC CICS READ
           FILE('CUSTOMER')
           INTO(WS-CUSTOMER-REC)
           RIDFLD(WS-CUST-ID)
           RESP(WS-RESP)
       END-EXEC.
       IF WS-RESP = DFHRESP(NORMAL)
           DISPLAY 'CUSTOMER FOUND: ' WS-CUSTOMER-NAME
       ELSE
           DISPLAY 'CUSTOMER NOT FOUND'
       END-IF.

Expected behavior: The program attempts to read a customer record by ID. If found, it displays the name. If not, it displays a not-found message.

Common Errors

1. ABEND AICA — CICS abend due to looping program

The program hit the loop limit (default 65536 iterations). Insert EXEC CICS DELAY or restructure the loop. Check your PERFORM or GO TO logic.

2. RESP not checked after EXEC CICS commands

A failed command (file not found, queue full) causes an abend if you do not check RESP. Always check return codes after every EXEC CICS command.

3. COMMAREA length mismatch

If the COMMAREA passed via RETURN TRANSID is a different length than the program expects in DFHCOMMAREA, data corruption occurs. Always check EIBCALEN first.

4. MAPFAIL condition

The BMS map name or mapset name is incorrect. Verify that the mapset was assembled and linked into the CICS region. Check the PPT entry.

5. TSQ limit exceeded

Temporary storage queues consume CICS storage. Long-running pseudo-conversational transactions accumulate TS records. Delete queues with DELETEQ TS when done.

6. WRITEQ TD queue full

Transient data queues have a defined maximum size. When the queue is full, WRITEQ fails. Increase the queue size in the CICS system initialization table (SIT).

Practice Questions

  1. What is the key difference between conversational and pseudo-conversational programming? Conversational holds the terminal and program resources while waiting for user input. Pseudo-conversational releases everything between transactions.

  2. What does COMMAREA do? It stores state information between successive invocations of a pseudo-conversational program, allowing the program to know which screen came next.

  3. How do you read a VSAM record in CICS? Use EXEC CICS READ FILE('filename') INTO(record-area) RIDFLD(key) RESP(return-code) END-EXEC.

  4. What is a BMS mapset used for? It defines the screen layout for 3270 terminals — positions for text, input fields, attributes, and protection settings.

Challenge: Design a four-screen CICS application for a library system: (1) patron ID menu, (2) patron details display with outstanding books, (3) book checkout screen, (4) confirmation. Use pseudo-conversational programming with COMMAREA for state management and TSQ for the checkout basket.

Mini Project

Task: Build a CICS Transaction for a bank account management system.

Create a pseudo-conversational CICS program that:

  • Screen 1: Prompts for an account number (customer enters account ID)
  • Screen 2: Displays account details (balance, last Transaction date, account type)
  • Screen 3: Offers options: view transactions or update address
  • Screen 4 (view transactions): Shows last 5 transactions from a TSQ
  • Screen 5 (update address): Accepts new address and updates the VSAM file

Use COMMAREA for state management between screens. Use TSQ for the Transaction history. Handle errors with RESP checking. Show the BMS map definitions for each screen.

What's Next

Tutorial What You'll Learn
DB2 for z/OS Guide Database access from CICS transactions using SQL
COBOL Explained — Beginner's Guide COBOL fundamentals for writing CICS programs
JCL Explained — Beginner's Guide Batch job submission for CICS batch processing

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro