Example: Applying OVRPRTF with *PRTF from multiple call levels

The example in this topic shows how printer-file overrides are applied from multiple call levels by using the *PRTF value.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
Figure 1. An example of printer-file overrides. By using the *PRTF value, you can apply printer-file overrides from multiple call levels.

                   Program A
Override 1    OVRPRTF FILE(*PRTF) COPIES(1)
Override 2    OVRPRTF FILE(PRT2) COPIES(2)
Override 3    OVRPRTF FILE(PRT4) COPIES(2)
                  CALL PGM(B)

                      Program B
Override 4       OVRPRTF FILE(*PRTF) LPI(4)
Override 5       OVRPRTF FILE(PRT3) LPI(8)
Override 6       OVRPRTF FILE(PRT4) LPI(8)
                     CALL PGM(X)

When program X opens the file PRT1, the opened file has the following attributes:
COPIES(1)
From Override 1
LPI(4)
From Override 4

Because no specific overrides are found for PRT1, *PRTF overrides (1 and 4) are applied.

When program X opens the file PRT2, the opened file has the following attributes:
COPIES(2)
From Override 2
LPI(4)
From Override 4

Because no specific override is found for PRT2 in program B, override 4 is applied. In program A, override 2 specifies PRT2 and is applied.

When program X opens the file PRT3, the opened file has the following attributes:
COPIES(1)
From Override 1
LPI(8)
From Override 5

In program B, override 5 specifies PRT3 and is applied. Because no specific override is found for PRT3 in program A, override 1 is applied.

When program X opens the file PRT4, the opened file has the following attributes:
COPIES(2)
From Override 3
LPI(8)
From Override 6

In program B, override 6 specifies PRT4 and is applied. In program A, override 3 specifies PRT4 and is applied.