File Management - IBM

File Management - IBM File Management - IBM

as400bks.rochester.ibm.com
from as400bks.rochester.ibm.com More from this publisher
30.06.2013 Views

46 File Management V4R5 Override 1 OVRDKTF FILE(PRTA) TOFILE(DKB) + LABEL(DKFIRST) CALL PGM(A) Program A Override 2 OVRPRTF FILE(DKA) TOFILE(PRTA) + SPOOL(*YES) CALL PGM(B) Program B Override 3 OVRDKTF FILE(PRTB) TOFILE(DKA) + DEV(DKT02) LABEL(DKLAST) Override 4 OVRDKTF FILE(DKA) TOFILE(DKC) + DEV(DKT02) LABEL(DKTTST) CALL PGM(C) Program C Override 5 OVRPRTF FILE(DKA) + TOFILE(PRTB) + SCHEDULE(*JOBEND) CALL PGM(D) Program D Override 6 OVRDKTF FILE(DKA) + VOL(MASTER) CALL PGM(MAKEMASTER) Program MAKEMASTER (Program MAKEMASTER attempts to open file DKA, but actually opens the diskette file DKB.) In the preceding example, the file that program MAKEMASTER actually opens is the diskette file DKB because of the following reasons: v Override 6, which is applied first, does not cause file DKA to be overridden with any other file. v Override 5, which is applied second, causes file DKA to be overridden with printer file PRTB. v Override 4 is ignored at this level because override 5 changed the file name to PRTB. v Override 3, which is applied third, causes file PRTB to be overridden with diskette file DKA. v Override 2, which is applied fourth, causes file DKA to be overridden with printer file PRTA. v Override 1, which is applied last, causes file PRTA to be overridden with diskette file DKB. Therefore, the file that program MAKEMASTER opens is the diskette file DKB. Because file DKB is a diskette file, the system overrides only those attributes that are specified on the Override with Diskette File (OVRDKTF) commands: VOL(MASTER) from override 6; DEV(DKT02) from override 3; and LABEL(DKFIRST) from override 1.

The attributes specified on the Override with Printer File (OVRPRTF) commands are ignored (even though they might have been allowed on the OVRDKTF commands). Refer to “Redirecting files” on page 64 for more information on the effect of overrides that change the file type. Processing overrides: General principles The system processes overrides according to the following general principles: v Overrides applied include any that are in effect at the time a file is opened by an application program, when a program that opens a file is compiled, or when certain system commands are used. (See “Overriding file attributes” on page 38, “Applying overrides when compiling a program” on page 53, and “Effect of overrides on some commands” on page 35). Thus, any overrides that are to be applied must be specified either before the file is opened by a program or before a program that opens the file is compiled. It is not necessary that overrides must be supplied for every file that is used in a program. Any file name for which no override is supplied is used as the actual file name. v Override commands that are scoped to the job level remain in effect until they are replaced, deleted, or until the job in which they are specified ends. For more information on deleting overrides, see “Deleting overrides” on page 54. v There can be only one active override for a file at each level (job level, activation group level, or call level). If more than one override for the same file exists at the same level, the most recent one is active. For an example of how the system processes overrides when more than one override for the same file exists at the same level, see “Overrides to the same file at the same call level: scenario 1” on page 49. v Override commands that are scoped to the job level apply to all programs that are running in the job regardless of the call level or activation group in which the overrides are specified. v Override commands that are scoped to an activation group level apply to all programs that are running in the activation group regardless of the call level in which the overrides are specified. v An override command (scoped to the call level) that is entered interactively exists at the call level for the caller of that command processor. For example, an override (scoped to the call level) that is entered on the command entry display cannot be deleted or replaced from a command processor that is called from the command entry display. v The call level of an override (scoped to the call level) that is coded in a CL program is the call level of the CL program. v An override (scoped to the call level) outside a program in a batch job takes the call level of the batch job command processor. v If an override command (scoped to the call level) is run using a call to the QCMDEXC program, the override takes the call level of the program that called the QCMDEXC program. For an example, see “CL program overrides” on page 50. v Exits (ENDPGM, RETURN, or abnormal exits) from a call operation delete overrides scoped to that call level. However, they do not delete overrides that are issued in that call level when they are scoped to the activation group level or the job level. For an example, see “Effect of exits on overrides: scenario” on page 48. v The TFRCTL command causes one program to be replaced by another program at the same call level. The program, to which control is transferred, runs at the Chapter 3. Using overrides 47

46 <strong>File</strong> <strong>Management</strong> V4R5<br />

Override 1 OVRDKTF FILE(PRTA) TOFILE(DKB) +<br />

LABEL(DKFIRST)<br />

CALL PGM(A)<br />

Program A<br />

Override 2 OVRPRTF FILE(DKA) TOFILE(PRTA) +<br />

SPOOL(*YES)<br />

CALL PGM(B)<br />

Program B<br />

Override 3 OVRDKTF FILE(PRTB) TOFILE(DKA) +<br />

DEV(DKT02) LABEL(DKLAST)<br />

Override 4 OVRDKTF FILE(DKA) TOFILE(DKC) +<br />

DEV(DKT02) LABEL(DKTTST)<br />

CALL PGM(C)<br />

Program C<br />

Override 5 OVRPRTF FILE(DKA) +<br />

TOFILE(PRTB) +<br />

SCHEDULE(*JOBEND)<br />

CALL PGM(D)<br />

Program D<br />

Override 6 OVRDKTF FILE(DKA) +<br />

VOL(MASTER)<br />

CALL PGM(MAKEMASTER)<br />

Program MAKEMASTER<br />

(Program<br />

MAKEMASTER<br />

attempts to open file<br />

DKA, but actually<br />

opens the diskette file<br />

DKB.)<br />

In the preceding example, the file that program MAKEMASTER actually opens is<br />

the diskette file DKB because of the following reasons:<br />

v Override 6, which is applied first, does not cause file DKA to be overridden<br />

with any other file.<br />

v Override 5, which is applied second, causes file DKA to be overridden with<br />

printer file PRTB.<br />

v Override 4 is ignored at this level because override 5 changed the file name to<br />

PRTB.<br />

v Override 3, which is applied third, causes file PRTB to be overridden with<br />

diskette file DKA.<br />

v Override 2, which is applied fourth, causes file DKA to be overridden with<br />

printer file PRTA.<br />

v Override 1, which is applied last, causes file PRTA to be overridden with<br />

diskette file DKB.<br />

Therefore, the file that program MAKEMASTER opens is the diskette file DKB.<br />

Because file DKB is a diskette file, the system overrides only those attributes that<br />

are specified on the Override with Diskette <strong>File</strong> (OVRDKTF) commands:<br />

VOL(MASTER) from override 6; DEV(DKT02) from override 3; and<br />

LABEL(DKFIRST) from override 1.

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

Saved successfully!

Ooh no, something went wrong!