Program linking

A LINK command is used to pass control from an application program at one logical level to an application program at the next lower logical level.

Application program logical levels

Application programs running under CICS® are executed at various logical levels. The first program to receive control within a task is at the highest logical level. When an application program is linked to another, expecting an eventual return of control, the linked-to program is considered to reside at the next lower logical level. When control is simply transferred from one application program to another, without expecting return of control, the two programs are considered to reside at the same logical level.

Link to another program expecting return

If the program receiving control is not already in main storage, it is loaded. When a RETURN command is processed in the linked program, control is returned to the program initiating the link at the next sequential process instruction.

The linked program operates independently of the program that issues the LINK command with regard to handling exception conditions, attention identifiers, and abends. For example, the effects of HANDLE commands in the linking program are not inherited by the linked-to program, but the original HANDLE commands are restored on return to the linking program. You can use the HANDLE ABEND command to deal with abnormal terminations in other link levels. See the CICS Application Programming Reference manual for programming information about this command. Figure 119 shows the concept of logical levels.

Figure 119. Application program logical levels
 Diagram showing CICS at level 0, initiating PROGA at level 1, which LINKs to PROGB at level 2. PROGB uses XCTL to transfer control to PROGC also at level 2, which LINKs to PROGD at level 3. PROGD then XCTLs to PROGE also at level 3. PROGE RETURNs to PROGC, and PROGC RETURNs to PROGA.
[[ Contents Previous Page | Next Page Index ]]