COBOL programs cannot recognize CICS commands. So all the CICS commands are coded within EXEC CICS and END-EXEC scope. The program is first passed to CICS Translator and the translator will convert all the CICS commands to COBOL call statements and this modified source is passed to COBOL compiler.
If your Program has DB2 commands then the sequence of preparing load module would be DB2 Pre-compiler, CICS Translator, COBOL Compiler and Link editor. Logically speaking the order of DB2 precompiler and CICS translator can be reversed also. But as a convention we are first doing precompilation.
If translation is done first, CICS translator tries to recognize to DB2 statements and would issue diagnostic messages. The other reason is, most of the programs do lot of DB2 operations than CICS operations. So if you do pre-compilation first, all the DB2 statements are converted into COBOL call statements in first phase itself and the translation time would be less.
COBOL-CICS programs should be compiled with RENT RESIDENT NODYNAM and LIB options.
Translator - Checks for syntax errors etc., in CICS commands & translate them into equivalent COBOL statements.
Looks for the statements EXEC CICS …
Comments out the entire EXEC CICS … END-EXEC statement
Replaces the CICS statements with a set of MOVE statements and COBOL “CALL” statements and passes as parameters, the command options.
Insert the Execute Interface Block copybook DFHEIBLK in the LINKAGE Section of the program.
Add the DFHCOMMAREA in the linkage section with a size of 1 byte if it is not specified.
Compiler - Expands COBOL copy books, checks the source code for syntax errors etc., and compiles.
Linkage Editor - Links different object modules to create a single load module.
As translator doesn’t expand COBOL copy books, they should not contain any CICS commands.
As the module is going to be a part of CICS program, it should not contain any restricted COBOL commands.
OS SVC Triggering statements:
ACCEPT, CURRENT-DATE, DATE, DAY, DISPLAY
Input/Output statements:
OPEN, CLOSE, READ, WRITE, REWRITE, DELETE, START
SORT statement:
RETURN, RELEASE
VS COBOL 2 allows STOP RUN and that returns control back to CICS.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!