XCTL, LINK and RETURN usages are different in CICS

How programs executed in CICS- When CICS initiates a task, it loads a program and transfers control to that program. That program, in turn, can invoke other programs.

Those programs will return control to the invoking program when their processing is complete. In other cases, those programs will return control to the program at the next higher logical level. And the initial program, of course, can return control to CICS and set up the next execution of that program.

The programs within a task can execute at different logical levels. When a program is invoked by CICS, for example, that program operates at the logical level below CICS. Then, that program can invoke another program using the XCTL command

 If the program is invoked with a LINK command, it operates at the logical level below the invoking program.

If the program is invoked with an XCTL command, though, the invoked program operates at the same logical level as the invoking program.

Read more: CICS+Tough+interview+questions

CICS Return
Gettyimages.in

How to understand logical levels in CICS

  1. CICS is at the highest logical level (level 0). When CICS invokes Program A, that program runs at the next lower level, level 1. When Program A issues a RETURN command, control returns to CICS at level 0. Notice that this RETURN command may or may not include a trans-id.
  2. Similarly, when Program A invokes Program B using a LINK command, Program B runs at the level below Program A (level 2 in this example). And when Program B issues a RETURN command (without a trans-id), control is passed back up to Program A.
  3. In contrast, when Program B invokes Program C using an XCTL command, Program C operates at the same logical level as Program B. Then, when Program C issues a RETURN command (without a trans-id), control returns not to Program B, but to the program that invoked Program B

Alternative to XCTL and LINK

CICS using a COBOL Call statement. And you can return control to an invoking program using a COBOL Goback statement. Frankly, you’re not likely to use the Goback statement in place of the RETURN command. But you may use the Call statement instead of the LINK command to invoke subprograms that are used more than once within the same execution of a program.

You need to use only RETURN command in CICS programs

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.