CICSbeginner
Common EXEC CICS Commands Overview
Build fluency with the everyday EXEC CICS command vocabulary for terminal I/O, file access, and program control.
Fluency with the everyday commands is what the more advanced topics sit on. This is the working vocabulary.
These core EXEC CICS commands are like the basic verbs of a language you need before you can hold any real conversation — SEND/RECEIVE are 'speak' and 'listen,' READ/WRITE/REWRITE/DELETE are 'look up,' 'add,' 'correct,' and 'remove' in a shared filing system, and LINK/XCTL are 'delegate and wait for them to finish' versus 'hand off the whole conversation and step away.'
Key Concepts
1
Terminal.
EXEC CICS SEND MAP('CUSTM1') MAPSET('CUSTMAP') ERASE END-EXEC.
EXEC CICS RECEIVE MAP('CUSTM1') MAPSET('CUSTMAP') END-EXEC.2
The plain SEND and RECEIVE forms work with unformatted text; the MAP forms go through BMS.
SENDRECEIVEMAP
3
File access.
READ fetch a record by key
READ ... UPDATE fetch it and lock it for update
WRITE add a new record
REWRITE update the record read for update
DELETE remove one
STARTBR / READNEXT / ENDBR browse sequentially4
EXEC CICS READ
FILE('CUSTFILE')
INTO(WS-REC)
RIDFLD(WS-KEY)
RESP(WS-RESP)
END-EXEC.5
READ UPDATE matters. REWRITE only works on a record read with UPDATE, and that read holds a lock
until the syncpoint. So read-for-update, change, rewrite, promptly — a long gap between them blocks
everyone else on that record.
READ UPDATEREWRITEUPDATE
6
Program control, and the difference that is always asked.
LINK call another program; control RETURNS here afterwards
XCTL transfer to another program; control NEVER returns7
LINK is a subroutine call and the caller's storage stays alive beneath it. XCTL hands over and the
caller is gone.
LINKXCTL
8
Choosing XCTL when you needed control back is a genuine design bug: the rest of your program never runs,
and nothing reports it.
XCTL
9
EXEC CICS LINK PROGRAM('VALIDATE') COMMAREA(WS-PARM) END-EXEC.
EXEC CICS XCTL PROGRAM('NEXTSCRN') COMMAREA(WS-STATE) END-EXEC.10
Ending a task.
EXEC CICS RETURN TRANSID('INQC') COMMAREA(WS-STATE) END-EXEC.
EXEC CICS RETURN END-EXEC. -- ends the transaction entirely11
Date and time.
EXEC CICS ASKTIME ABSTIME(WS-ABSTIME) END-EXEC.
EXEC CICS FORMATTIME ABSTIME(WS-ABSTIME)
DDMMYY(WS-DATE) TIME(WS-TIME) END-EXEC.12
Put RESP on everything that can fail. The baseline expectation in an interview is sketching a
read-a-record-and-display-it flow from memory, with the error check present rather than assumed.
RESP
13
What the interviewer is probing.1. "What does EXEC CICS RETURN with TRANSID do?" Probing: the key command. Stalls: "Ends the
program." Moves up: ends the task and tells CICS which transaction to start on the next input,
which is what makes pseudo-conversational flow work.
14
2. "What is the difference between LINK and XCTL?" Probing: the distinction. Stalls:
"Nothing." Moves up: LINK returns to the caller; XCTL transfers control and does not come back, so
the caller's storage is released.
15
3. "What does SEND MAP ERASE do that SEND MAP alone does not?" Probing: the detail. Stalls:
"Nothing." Moves up: clears the screen first, which prevents remnants of the previous map showing
through.
16
4. "How does START differ from LINK?" Probing: the breadth. Stalls: "They are the same."
Moves up: START schedules a separate task, optionally later or on another region — it is
asynchronous, where LINK is a synchronous call.