30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Effect of TFRCTL on overrides-Scenario<br />

The TFRCTL command replaces one program with another program at the same<br />

call level. The program to which control is transferred runs at the same call level as<br />

the program that contained the TFRCTL command. An override command in a<br />

program that transfers control to another program is not deleted during the<br />

transfer of control. In the following example, program A transfers control to<br />

program B, and program B runs in the same call level as program A. The Override<br />

with Database <strong>File</strong> (OVRDBF) command causes the file to be positioned at the last<br />

record of the member when it is opened and is used for both programs A and B.<br />

CALL PGM(A)<br />

Program A<br />

OVRDBF FILE(INPUT) POSITION(*END)<br />

(INPUT is opened and positioned at the last<br />

record of the member and closed after<br />

processing.)<br />

TFRCTLPGM(B)<br />

Program B<br />

(INPUT is opened and positioned at the last<br />

record of the member.)<br />

Overrides to the same file at the same call level: scenario 1<br />

When you enter two overrides for the same file name at the same call level, the<br />

second override replaces the first override. This allows you to replace an override<br />

at a single call level, without having to delete the first override (see “Deleting<br />

overrides” on page 54). For example:<br />

Override 1 OVRDKTF FILE(QDKTSRC) LABEL(X)<br />

CALL PGM(REORDER)<br />

Override 2 OVRDKTF FILE(QDKTSRC) LABEL(Y)<br />

CALL PGM(REORDER)<br />

Assume that program REORDER uses the diskette file QDKTSRC. Override 1<br />

causes the first call to program REORDER to use the source file with a label of X<br />

for its processing. Override 2 causes the second call to program REORDER to use<br />

the source file with a label of Y for its processing.<br />

Overrides to the same file at the same call level: scenario 2<br />

When you enter two overrides for the same file name at the same call level, the<br />

second override replaces the first override.<br />

In the following example, when the program attempts to open FILE A, FILE B<br />

overrides FILE A because of override 2. Because only one override can be applied<br />

for each call level, the system ignores override 1, and the file opened by the<br />

program is FILE B.<br />

Chapter 3. Using overrides 49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!