It is good practice to develop several functional modules rather than building one lengthy program that does all the functions. It makes the program tough to maintain, understand and debug. The size of the program will be large and it also occupies more resources. Functional splitting of sub modules and calling or transferring the control to them is achieved by program control commands.
Control Commands are
To pass control to a program at a lower logical level expecting control to be returned to the program at the higher logical level.
To pass control to another program at the same level not expecting the control to be returned.
To return to the next logical higher level program or to CICS.
To perform a COBOL Call from one CICS program to another COBOL program.
To Load a program into the CICS address space.
To Release the program from CICS address space.
The application programs under CICS run under various logical levels. At the highest level is CICS (Level 0). All application programs run at lower logical levels.
A LINK’ed program runs at the next lower logical level from the linking program.
A XCTL’ed program runs at the same logical level as the XCTL’ing program.
The RETURN command always passes control back to the program at one logical level higher.
The visual explains the flow of control between programs.
The program A is at the highest logical level under CICS (level 1).
RETURN from program A cause control return to CICS (level 0).
When program A issues XCTL to program B, the program B will be at the same logical level (level 1).
When program A issues a LINK to program C, program C will be at level 2.
RETURN from program C passes control to level 1 (program A).
RETURN from program B passes control to level 0 (CICS).
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!