CICS Transaction Processing — COBOL Programs, BMS Maps, Pseudo-Conversational Programming
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
- The architecture of CICS regions and how they manage concurrent transactions
- Writing CICS COBOL programs with EXEC CICS commands
- Designing BMS mapsets for user interface screens
- Using transient data queues (TDQ) and temporary storage queues (TSQ)
- Pseudo-conversational programming with COMMAREA for state management
- File control operations for reading and updating VSAM/DB2 data
Why CICS Matters
Most mainframe transactions — 90%+ — 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.
Learning Path
flowchart LR
A["Mainframe Overview"] --> B["COBOL Programming"]
B --> C["JCL Job Control"]
C --> D["CICS Transactions<br/>You are here"]
D --> E["DB2 for z/OS"]
E --> F["IMS Database"]
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<br/>"]
PC["Program Control"]
FC["File Control"]
TC["Terminal Control"]
SC["Storage Control"]
DC["Temporary Storage<br/>& 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 output: The message “WELCOME TO CICS” appears on the terminal screen.
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.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, program 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<br/>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=FINALThe 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/TDO)
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.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 = DFHRESP(NOTFND) on READ
The record does not exist in the file. Always check RESP after every EXEC CICS command before using the data.
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
What is the key difference between conversational and pseudo-conversational? Conversational holds the terminal and program resources while waiting for user input. Pseudo-conversational releases everything between transactions.
What does COMMAREA do? It stores state information between successive invocations of a pseudo-conversational program, allowing the program to know what screen came next.
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.What is a BMS mapset used for? It defines the screen layout for 3270 terminals — positions for text, input fields, attributes, and protection settings.
How do you pass control to another CICS program? Use
EXEC CICS XCTL PROGRAM('next-prog') COMMAREA(data) END-EXECfor one-way transfer, orLINKfor call-and-return.
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.
FAQ
Try It Yourself
Run a CICS transaction simulation in Python:
# Simulate pseudo-conversational CICS transaction
class CICSTransaction:
def __init__(self):
self.state = 'INIT'
self.commarea = {}
def process(self, user_input=None):
if self.state == 'INIT':
print("=== CICS MAIN MENU ===")
print("1. Customer Inquiry")
print("2. Account Update")
print("3. Exit")
self.state = 'MENU'
return "MENU"
elif self.state == 'MENU':
choice = user_input.strip()
if choice == '1':
print("Enter Customer ID: ")
self.state = 'INQUIRY'
elif choice == '2':
print("Enter Account Number: ")
self.state = 'UPDATE'
elif choice == '3':
print("Goodbye.")
return "EXIT"
return self.state
elif self.state == 'INQUIRY':
print(f"Displaying details for customer {user_input}")
self.state = 'MENU'
return "MENU"
# Simulate a pseudo-conversational flow
tran = CICSTransaction()
tran.process() # Shows menu
tran.commarea = {'state': 'MENU'}
tran.process('1') # Select inquiry
tran.commarea = {'state': 'INQUIRY'}
tran.process('CUST001') # Enter customer IDExpected output: Menu → inquiry selection → customer detail display, demonstrating the state-passing pattern.
What’s Next
| Tutorial | What You’ll Learn |
|---|---|
| DB2 for z/OS Guide | Database access from CICS transactions |
| COBOL Programming Guide | COBOL fundamentals for CICS programs |
| JCL Job Control Guide | Batch job submission for CICS batch processing |
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-20.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro