This form of overriding files is a combination of overriding file attributes and overriding file names or types. 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 be printed using printer file REPORTS instead of printer file OUTPUT (OUTPUT is specified in the application program). In addition to having the application program use printer file REPORTS, you want to override the number of printed copies to three. Assume printer file REPORTS was created with the following command:
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 three copies of the output are printed using the REPORTS printer file.
Note that this is not equal to the following two override commands:
Only one override is applied for each call level for an open of a particular file, so if you want to override the file that is used by the program and also override the attributes of the overriding file from one call level, you must use a single command. If two overrides are used, the first override will cause the output to be printed using the REPORTS printer file, but the second override will be ignored.