Module 4: CICS COBOL Programming
COBOL and CICS
COBOL and CICS go hand in hand. CICS is the transaction processing system on the mainframe, and COBOL is the most common language used to write programs that run under it.
What is CICS
- CICS stands for Customer Information Control System. It is IBM's transaction processing monitor that runs on z/OS.
- It lets thousands of users work on the same system at the same time through online terminals.
- Application programs run under CICS control. CICS manages the terminals, files, programs and storage for them.
- A user starts a program by typing a short transaction id (for example, EMPI). CICS finds the program and runs it.
Why COBOL is used with CICS
- COBOL is the main business language on the mainframe, so most CICS application programs are written in COBOL.
- CICS commands are written directly inside the COBOL source using EXEC CICS statements.
- It is the same COBOL you already know, plus extra commands for terminal input/output, file access and program control.
- Other languages (PL/I, C, Assembler) can also be used, but COBOL is the standard choice in most shops.
Batch COBOL vs CICS COBOL
- A batch COBOL program runs once from start to finish, reads its own files, and ends with STOP RUN.
- A CICS COBOL program is started by a transaction id, handles one terminal interaction, and ends with EXEC CICS RETURN.
- CICS programs are quasi-reentrant: one copy of the program in memory can serve many users at the same time.
- Batch verbs like DISPLAY, ACCEPT, READ and WRITE are replaced by EXEC CICS commands such as SEND, RECEIVE and READ.
A first look at a CICS command
- Below is the simplest CICS program logic: send a message to the terminal and return control to CICS.
- EXEC CICS marks the start of a CICS command and END-EXEC marks its end.
EXEC CICS SEND TEXT
FROM('WELCOME TO CICS')
LENGTH(15)
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
FROM('WELCOME TO CICS')
LENGTH(15)
ERASE
END-EXEC.
EXEC CICS RETURN
END-EXEC.
