Overrides to the same file at the same call level: scenario

When you enter two overrides for the same file name at the same call level, the second override replaces the first override. This allows you to replace an override at a single call level, without having to delete the first override.

In the following example, when the program attempts to open FILE A, FILE B overrides FILE A because of override 2. Because only one override can be applied for each call level, the server ignores override 1, and the file opened by the program is FILE 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 server response to the open file command using overrides. Only one override can be applied for each call level. The following example outlines how the server ignores the first override and performs the second override.

                            Program A
                               .
                               .
                               .
Override 1              OVRDBF FILE(B) TOFILE(C)
Override 2              OVRDBF FILE(A) TOFILE(B)
                               .
                               .
                               .
                           OPEN FILE A
                               .
                               .
                               .

To open FILE C, replace the two Override with Database File (OVRDBF) commands with the following command:
OVRDBF FILE(A) TOFILE(C)

This does not prevent applying an override at the same call level or job level in which the file is created. Regardless of which attribute is encountered first, file attributes on the override take the place of corresponding attributes on the create statement for the file.

Related concepts
Delete overrides