Skip to content
systemcoding.dev
Mainframe

Test CICS Commands Interactively With CECI

Run EXEC CICS commands one at a time from a 3270 screen with CECI, read the response and EIBRESP values, check syntax with CECS and know the production limits.

5 min read
Summarize in AI
Flat illustration of a terminal session, with the GNU Bash, Ubuntu and Linux logos.

Before you put a READ FILE or WRITEQ TS into a program, it helps to see what the command does with your real data. The CICS command-level interpreter, CECI, lets you type an EXEC CICS command at a terminal, run it and look at the result, with no compile and no program. This post shows how to use CECI in CICS Transaction Server for z/OS 6.1 on z/OS 3.1: running a command, reading its response, using variables, and a separate transaction, CECS, that checks syntax without running anything. We also say plainly why a production region usually bans it.

Starting CECI

Clear the screen, type CECI and press Enter. The interpreter shows a prompt for a command.

Text
CECI

Type a command without the EXEC CICS prefix and without the END-EXEC terminator. For a first test, send text to the screen itself.

Text
SEND TEXT FROM('HELLO FROM CECI') ERASE

Press Enter, and CECI expands the command, filling in options with defaults, and shows it with a status line. At that point nothing has run yet. Press Enter again to execute it. The screen clears and shows the text, because ERASE was given, and a return to the CECI panel needs a key press.

Text
HELLO FROM CECI

Two-step execution is a safety feature. The first Enter checks and expands, the second Enter runs. You can edit options on the expanded form before running, and the interpreter flags unknown options.

Reading the response

After execution the panel shows the outcome, with the response condition and the execute interface block values.

Text
 STATUS: COMMAND EXECUTION COMPLETE
 NAME= EXEC CICS SEND TEXT
 ...
 RESPONSE: NORMAL                 EIBRESP=+0000000000
                                  EIBRESP2=+0000000000

NORMAL means the command worked, and EIBRESP=0 is its numeric form. When something goes wrong, the name of the condition appears instead, such as NOTFND or INVREQ, with a nonzero EIBRESP and often a nonzero EIBRESP2 that pinpoints the reason. Reading EIBRESP2 is the main benefit of testing in CECI, because the second code narrows a condition such as INVREQ to one specific cause, and the manual lists the meaning of each value for each command.

Reading a file record

A real use is to look at a record before writing code against it. This command reads a record from a file defined to CICS, here a VSAM file named ORDFILE with an eight-byte key.

Text
READ FILE('ORDFILE') INTO(&REC) RIDFLD('ORD00042') LENGTH(&LEN)

&REC and &LEN are CECI variables. A name beginning with an ampersand is a user variable that CECI creates when needed and keeps for the session. After the command runs, display a variable by typing &REC in the variable display, or press the key shown on the screen to show variables. The data appears in character and hexadecimal form, which is useful because it shows packed fields as they really are stored, and lets you check offsets against your record layout.

If the key does not exist, the response is NOTFND with EIBRESP=+0000000013. The number 13 is the value CICS assigns to NOTFND, and a program that tests RESP against DFHRESP(NOTFND) is comparing against that same value.

Using variables as test data

You can build small tests by setting variables first. Give &AMOUNT a value by typing a command that references it as an input or by using the variable panel to enter data. Then run a WRITEQ TS to a temporary storage queue and read it back to confirm what a program would see.

Text
WRITEQ TS QUEUE('TESTQ01') FROM('FIRST ITEM') ITEM(&ITM)
READQ TS QUEUE('TESTQ01') INTO(&OUT) ITEM(1)

After the first command &ITM holds the item number that was assigned, 1 for a new queue. After the second, &OUT holds FIRST ITEM. Delete the queue afterwards with DELETEQ TS QUEUE('TESTQ01'), since CECI leaves it in the region until you do. This kind of two-command experiment settles questions such as whether a queue was created recoverable, which is hard to answer by reading code.

CECS: syntax only

CECS is the same interpreter with the execute step removed. It checks that the command is valid and the options are legal and shows the expanded form, but it never runs the command. Use it when you want to test the spelling and option mix of a command that would change data, such as REWRITE or DELETE.

Text
CECS DELETE FILE('ORDFILE') RIDFLD('ORD00042')

The panel reports a syntax result and stops. Run the equivalent in CECI only when you really mean it, and only in a test region.

Why production regions block it

CECI can do anything a program can do under the signed-on user's authority. It can read, rewrite and delete file records, start transactions, change queues and issue SET commands. A developer with access to CECI in production can alter live data with no program, no review and no change record. For that reason, CICS security normally restricts the CECI and CEDA transactions to a small group, and many shops remove them from production regions. Treat it as a test-region tool. If you need to inspect data in production, use read-only inquiry transactions and your site's browse tools, and make any change through a controlled program.

A smaller risk exists in test regions too. A command executed by mistake changes shared test data, which may confuse other developers. Use a queue or a file that you created for the test, and name it so others can see whose it is.

Where CECI is not the right tool

CECI does not run a program, so it cannot reproduce a defect that depends on a sequence of commands in a task. It also runs each command in its own context: commands that depend on a held state, such as a browse started with STARTBR and continued with READNEXT, can be done in one session, but a lock you take lasts only as long as the CECI task keeps running. For flow-level problems use the debug transaction CEDF, which steps through a real program.

A worked debugging session

Suppose a program fails with NOTFND on a read that you believe is correct. In CECI, run the same READ with the key your program builds. Copy the key from the program's trace or dump, including trailing blanks. If CECI finds the record with the key typed as ORD00042 and not with ORD00042 padded to ten characters, you have found the mismatch between the file's key length and the program's field. That kind of five-minute answer is why the tool earns a place in your toolkit, and it is the reason to learn its panels before you need them under pressure.

Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.