In CICS, which commands belong to program control and are used to transfer control between programs or return to CICS?

Difficulty: Medium

Correct Answer: LINK, XCTL, and RETURN are key CICS program control commands used to transfer control between programs and return to the CICS environment

Explanation:


Introduction / Context:
CICS applications are often composed of multiple programs that call each other or pass control in a structured way. Program control commands are used to link programs, transfer control permanently, and return to the CICS dispatcher. Interview questions about these commands help assess whether candidates understand modular design and control flow in CICS applications.


Given Data / Assumptions:

  • We are working with CICS application programs written in COBOL, PL/I, or another supported language.
  • Programs may need to call subprograms, replace themselves with another program, or return control to CICS at the end of a transaction.
  • CICS provides specific EXEC CICS commands to manage this program control flow.


Concept / Approach:
Program control in CICS is primarily managed through commands such as LINK, XCTL, and RETURN. LINK passes control to another program and expects control to return to the caller, similar to a subroutine call. XCTL transfers control to another program and does not return to the caller, replacing the current program. RETURN ends the current program's execution and returns control either to the higher level program that linked to it or to the CICS dispatcher at the end of the transaction. These commands work with COMMAREA or channels and containers to pass data between programs.


Step-by-Step Solution:
Step 1: EXEC CICS LINK PROGRAM(prog-name) is used when the current program wants to call another program as a subprogram, passing a COMMAREA or containers; control returns to the caller when the linked program issues RETURN. Step 2: EXEC CICS XCTL PROGRAM(prog-name) transfers control permanently to another program. The current program does not regain control; after XCTL, the new program runs as if it were the main program in that part of the transaction. Step 3: EXEC CICS RETURN is used by a program to indicate that it has finished processing. If it was invoked through LINK, control returns to the caller. If it was the top-level program for the transaction, control returns to CICS, and the transaction may end or switch to a new task. Step 4: These commands often work with options like COMMAREA(length) or channels to pass data structures between programs, enabling modular and reusable application design. Step 5: Understanding how LINK, XCTL, and RETURN interact helps you design CICS applications that are easier to maintain, test, and extend.


Verification / Alternative check:
Program traces and CICS monitoring tools show LINK and XCTL calls as program transitions, with RETURN calls marking the completion of modules. Documentation for CICS clearly categorises LINK, XCTL, and RETURN under program control, distinct from file control and task control commands. Experiments with small sample programs demonstrate that LINK returns control to the caller while XCTL does not, confirming the intended behaviours.


Why Other Options Are Wrong:
Option B is incorrect because READ, WRITE, and DELETE are file control operations, not program control; they operate on data, not on program flow. Option C is wrong because WRITEQ TS, WRITEQ TD, and SYNCPOINT deal with queues and syncpoints, not with transferring control between programs. Option D is incorrect because HANDLE CONDITION and NOHANDLE control error handling behaviour, not program-to-program transfer, and IGNORE is not a standard CICS program control command.


Common Pitfalls:
A common pitfall is using XCTL where LINK would be more appropriate, or vice versa, which can complicate control flow and make debugging difficult. Another issue is failing to manage COMMAREA sizes correctly, leading to truncation or mismatches between caller and called programs. Developers must also remember that excessive program chaining can affect performance and complexity. By understanding and correctly using LINK, XCTL, and RETURN, you can build modular CICS applications with clear, predictable control paths.


Final Answer:
The main CICS program control commands are LINK, XCTL, and RETURN, which are used to pass control between programs and to return control to the CICS dispatcher or calling program.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion