Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: CICS Transactions and Commands


CICS Command Structure

Every request a program makes to CICS uses the same command structure. Learn the pattern once and you can read any CICS command.

The general format

  • Every command starts with EXEC CICS and ends with END-EXEC.
  • The command name (verb) comes first, for example READ, SEND, RETURN, LINK.
  • In COBOL the whole command is a sentence, so it ends with a period after END-EXEC.
  • Commands can be written across many lines — only the period ends them.

Options and arguments

  • After the verb come options: keyword followed by a value in brackets, like FILE('CUSTMAS') or LENGTH(100).
  • The value can be a data-name, a literal, or a number — for example INTO(CUSTOMER-RECORD) or RIDFLD(WS-CUST-NO).
  • Input options pass data to CICS; output options receive data back from CICS.
  • Most options can be coded in any order, but some combinations are illegal — the translator will tell you.
  • The RESP option catches the response code so you can handle exceptional conditions yourself.

The translator step

  • The COBOL compiler does not understand EXEC CICS, so a translator runs before the compiler.
  • The translator converts each command into CALL statements to CICS service routines.
  • It also generates the DFHEIBLK and DFHCOMMAREA linkage automatically — never code them yourself.
  • After translation the program compiles like any normal COBOL program.
  • Example of the structure, first as a template and then as a real command:-
    *--- General structure of a CICS command ---* EXEC CICS command-name OPTION-1(data-name-1) OPTION-2(data-name-2) RESP(WS-RESP-CODE) END-EXEC. *--- A real example: read one VSAM record ---* EXEC CICS READ FILE('CUSTMAS') INTO(CUSTOMER-RECORD) RIDFLD(CUSTOMER-NUMBER) RESP(WS-RESP-CODE) END-EXEC.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant