Override file names and file attributes

This form of overriding files is a combination of overriding file attributes and overriding file names. With this form of override, you can override the file that is to be used in a program and you can also override the attributes of the overriding file.

For example, you want the output from your application program to print using the printer file REPORTS instead of the printer file OUTPUT (the application program specifies the OUTPUT printer file). In addition to having the application program use the printer file REPORTS, you want to produce three copies. Assume that the following command created the file REPORTS:
CRTPRTF FILE(REPORTS) SPOOL(*YES) +
  PAGESIZE(68 132) LPI(8) OVRFLW(60) +
  COPIES(2) FILESEP(1)
Before you run the program, type the following command:
OVRPRTF FILE(OUTPUT) TOFILE(REPORTS) COPIES(3)

Then call the application program, and the program produces three copies of the output using the printer file REPORTS.

Note that this is not equal to the following two override commands:

Override 1 OVRPRTF FILE(OUTPUT) TOFILE(REPORTS)
Override 2 OVRPRTF FILE(REPORTS) COPIES(3)

Only one override is applied for each call level for an open of a particular file; therefore, if you want to override the file that the program uses and also override the attributes of the overriding file from one call level, you must use a single command. If you use two overrides, the first override uses the printer file REPORTS to print the output. The server ignores the second override.