Handy guide to write CICS logic in COBOL program

You already know that CICS follows pseudo conversational approach..

Recap the main points… it releases resources when not needed..

Next point is…

How to execute CICS commands…

CICS is an API in mainframe environment. You cannot access CICS directly. You need to embed code mentioned below to access CICS.

EXEC CICS
.
.
END-EXEC.

In between the above exec statements you can write your CICS commands.

The Exec CICS….END-Exec must start after column 12 as with normal COBOL commands

The ways CICS program differs

  • The first and most important difference is you do not define files in CICS program

Like OPEN, CLOSE, READ, WRITE are not permitted

Reflections
Image Courtesy|Stockphotos.io

The reason why you do not define files…

Files you need to define to CICS in FCT also called File control table. The FCT contains all the information needed to access file.

If you want to use any new file, then, you need to define it to CICS. File OPEN and CLOSE also handled by CICS.

That’s why not needed in COBOL module

Ok so far good…

To terminate CICS program you need to write…

EXEC CICS
REURN
END-EXEC

The words STOP RUN, EXIT-PROGRAM and GO BACK will not work in CICS. After RETURN gives control to called module, else to CICS.

How to compile CICS program

The first step is ‘pre-compilation’.

The pre-compiler read your program and convert the CICS commands into COBOL call commands. As of newer version separate pre-compiler not needed. It is in-built in compiler.

Subscribe for our daily tips


How many ways data can be passed

〉The EIB also called execute interface block. This is a special block of data passed between programs.

It contains system information, and it can be used by your program. The EIB is copied into your program when you compile. The system information populated into it when the program runs.

〉How data will be passed using COMMAREA (DFHCOMMAREA) – The purpose of it is to pass user data between your programs.

〉The TDQ and TSQ are the other methods you can pass user data between programs

The TSQs you no need to define before running your program. But, TDQs you need to define. TDQs you can access data both sequential and Random ways. But TSQs only in sequential way you can access data.

〉The next method is of course using ‘FILES’ you can pass data.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.