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.
CICS Program
We will be writing a simple COBOL-CICS program which displays some message on the CICS output screen. This program is to demonstrate the steps involved in executing a COBOL-CICS program. Following are the steps to code a simple program −
Step 1
Login to Mainframes and open a TSO Session.
Step 2
Create a new PDS in which we will be coding our program.
Step 3
Create a new member inside the PDS and code the following program −
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 WS-MESSAGE PIC X(40). 01 WS-LENGTH PIC S9(4) COMP. PROCEDURE DIVISION. A000-MAIN-PARA. MOVE 'Hello World' TO WS-MESSAGE MOVE '+12' TO WS-LENGTH EXEC CICS SEND TEXT FROM (WS-MESSAGE) LENGHT(WS-LENGTH) END-EXEC EXEC CICS RETURN END-EXEC.
Step 4
After coding the program, we need to compile it. We can compile the program using the following JCL −
//SAMPLE JOB(TESTJCL,XXXXXX),CLASS = A,MSGCLASS = C //CICSCOB EXEC CICSCOB, //COPYLIB = ABC.XYZ.COPYLIB, //LOADLIB = ABC.XYZ.LOADLIB //LIB JCLLIB ORDER = CICSXXX.CICS.XXXPROC //CPLSTP EXEC DFHEITVL //TRN.SYSIN DD DSN = ABC.XYZ.PDS(HELLO),DISP = SHR //LKED.SYSIN DD * NAME HELLO(R) //
Step 5
Open a CICS session.
Step 6
We will now install the program using the following command −
CEMT SET PROG(HELLO) NEW.
Step 7
Execute the program using the associated transaction-id. Transaction-id is provided by the Administrator. It will show the following output −
Program Compilation
The following flowchart shows the steps used in compiling a COBOL-CICS program −
Translator
The function of a translator is to check for syntax errors in CICS commands. It translates them into equivalent COBOL statements.
Compiler
The function of a compiler is to expand the COBOL copy books. It compiles the code after checking the source code for syntax errors.
Linkage Editor
The function of a Linkage Editor is to link different object modules to create a single load module.
No comments:
Post a Comment