Effect of TFRCTL on overrides: Scenario

The TFRCTL command replaces one program with another program at the same call level. The program to which control is transferred runs at the same call level as the program that contained the TFRCTL command. An override command in a program that transfers control to another program is not deleted during the transfer of control.

In the following example, program A transfers control to program B, and program B runs in the same call level as program A. The Override with Database File (OVRDBF) command causes the file to be positioned at the last record of the member when it is opened and is used for both programs A and B.

Note: By using the code example, you agree to the terms of the Code license and disclaimer information.
Figure 1. An example of the TFRCTL command. The TFRCTL command replaces one program with another program at the same call level, which is outlined in the figure below.

CALL PGM(A)
    Program A

    OVRDBF FILE(INPUT) POSITION(*END)

(INPUT is opened and positioned at the last
record of the member and closed after
processing.) TFRCTL PGM(B)
Program B

(INPUT is opened and positioned at the last
record of the member.)