TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

CICS Programs


CICS programs are written in COBOL language in Mainframes. We will be discussing about writing a simple COBOL-CICS program, compiling it, and then executing it.

Structure of CICS Application Program

structure of cics program

General Syntax of CICS statement

EXEC CICS function
 	[(option (argument value)]
        [(option (argument value)]
END-EXEC.

Basic Steps in CICS Application Program Development

  1. Translate, compile and linkedit a CICS application program into the CICS application program library (LOADLIB).

  2. Define Trans-ID into PCT with associated program name

  3. Define program into PPT

  4. Register Terminal into TCT

  5. Register the user in SNT(Sign-On Table)

  6. Other CICS tables e.g. FCT, JCT, DCT must be prepared for the application programming if required

  7. Sign-On CICS and enter Trans-ID.

In addition to the above basic procedures, the detailed CICS system environment must be prepared properly by the system programmers or application programmers.

  • The terminal must be registered in the TCT.

  • The CICS user identifier must be registered in the SNT.

  • Other CICS tables (viz. FCT, JCT, and DCT) must be prepared for the application program, if required.


Example 1 - COBOL-CICS Program

Below is a simple COBOL-CICS program which displays message "Welcome to IBMMainframer Community" on the CICS output screen.

IDENTIFICATION DIVISION.
PROGRAM-ID. IBMMFPGM.

DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
01 WS-DISP-MESSAGE PIC X(40).
01 WS-DISP-LENGTH  PIC S9(4) COMP.

PROCEDURE DIVISION.
0000-MAIN-PARA.
   MOVE 'WELCOME TO IBMMAINFRAMER COMMUNITY' TO WS-DISP-MESSAGE
   MOVE '+34' TO WS-DISP-LENGTH

   EXEC CICS SEND TEXT
      FROM (WS-MESSAGE)
      LENGHT(WS-LENGTH)
   END-EXEC

   EXEC CICS
      RETURN
   END-EXEC.

This simple program uses CICS commands SEND TEXT, which is used to sends data without mapping to terminal and RETURN command is used to returns program control.


Example 2 - COBOL-CICS Program

This sample program uses three basic CICS commands RECEIVE, SEND and RETURN.

This program will

  • Read a message from the terminal.

  • Send the message back with acknowledge message.

  • Terminate the transaction.

Note the error handling part after the EXEC CICS RECEIVE command.

sample cics program

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal