Sample Programs In Cics Cobol
This is beautiful feature of CICS online transaction server. For online transactions you need a screen, so that user will interact with the system to get required information.CICS provides all the facilities to develop maps.During development you need to write physical map in a specified library for development.When you compile the physical map by using any mainframe tools like Changeman, Endevor, IBM-debugger etc., it creates symbolic map.The point is your program needs always symbolic map.
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 ProgramWe 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 1Login to Mainframes and open a TSO Session. Step 2Create a new PDS in which we will be coding our program.
Step 3Create 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-MESSAGEMOVE '+12' TO WS-LENGTHEXEC CICS SEND TEXTFROM (WS-MESSAGE)LENGHT(WS-LENGTH)END-EXECEXEC CICS RETURNEND-EXEC.Step 4After 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 5Open a CICS session. Step 6We will now install the program using the following command −CEMT SET PROG(HELLO) NEW.Step 7Execute the program using the associated transaction-id. Transaction-id is provided by the Administrator.
Cics Commands
It will show the following output − Program CompilationThe following flowchart shows the steps used in compiling a COBOL-CICS program − TranslatorThe function of a translator is to check for syntax errors in CICS commands. It translates them into equivalent COBOL statements. CompilerThe function of a compiler is to expand the COBOL copy books.
It compiles the code after checking the source code for syntax errors. Linkage EditorThe function of a Linkage Editor is to link different object modules to create a single load module.