A transaction (task) may execute several programs in the course of completing its work.

The program definition contains one entry for every program used by any application in the CICS® system. Each entry holds, among other things, the language in which the program is written. The transaction definition has an entry for every transaction identifier in the system, and the important information kept about each transaction is the identifier and the name of the first program to be executed on behalf of the transaction.

You can see how these two sets of definitions, transaction and program, work in concert:
The user types in a transaction identifier at the terminal (or the previous transaction determined it).

  • CICS looks up this identifier in the list of installed transaction definitions.
    This tells CICS which program to invoke first.
  • CICS looks up this program in the list of installed transaction definitions, finds out where it is, and loads it (if it isn’t already in the main storage).
  • CICS builds the control blocks necessary for this particular combination of transaction and terminal, using information from both sets of definitions. For programs in command-level COBOL, this includes making a private copy of working storage for this particular execution of the program.
  • CICS passes control to the program, which begins running using the control blocks for this terminal. This program may pass control to any other program in the list of installed program definitions, if necessary, in the course of completing the transaction.

There are two CICS commands for passing control from one program to another. One is the LINK command, which is similar to a CALL statement in COBOL. The other is the XCTL (transfer control) command, which has no COBOL counterpart. When one program links another, the first program stays in main storage. When the second (linked-to) program finishes and gives up control, the first program resumes at the point after the LINK. The linked-to program is considered to be operating at one logical level lower than the program that does the linking.

In contrast, when one program transfers control to another, the first program is considered terminated, and the second operates at the same level as the first. When the second program finishes, control is returned not to the first program, but to whatever program last issued a LINK command.

Some people like to think of CICS itself as the highest program level in this process, with the first program in the transaction as the next level down, and so on. Figure 1 illustrates this concept.

The LINK command looks like this:
COMMAREA(commarea) LENGTH(length) END-EXEC.

where pgmname is the name of the program to which you wish to link. commarea is the name of the area containing the data to be passed and/or the area to which results are to be returned. The COMMAREA interface is also an option to invoke CICS programs.

A sound principle of CICS application design is to separate the presentation logic from the business logic; communication between the programs is achieved by using the LINK command and data is passed between such programs in the COMMAREA. Such a modular design provides not only a separation of functions, but also much greater flexibility for the Web enablement of existing applications using new presentation methods.