Override file attributes

The simplest form of overriding a file is to override some attributes of the file. For example, assume that you create a printer file named OUTPUT with these attributes:

The Create Printer File (CRTPRTF) command used to create this file looks like this:

CRTPRTF FILE(QGPL/OUTPUT) SPOOL(*YES)
PAGESIZE(66 132) LPI(6)
COPIES(2)  FILESEP(2)  OVRFLW(55)

The printer file named OUTPUT is specified in your application program with an overflow line number of 58. However, before you run the application program, you want to change the number of copies of printed output to 3 and the overflow line to 60. The override command looks like this:

OVRPRTF  FILE(OUTPUT)  COPIES(3)  OVRFLW(60)

When you call the application program, three copies of the output are printed.

When the application program opens the file, the file overrides, program-specified attributes, and file attributes are merged to form the open data path (ODP), which is used to manage the file during the running of the program. File overrides have precedence over program-specified attributes. Program-specified attributes have precedence over file-specified attributes. In this example, when the file is opened and output operations are performed, spooled output will be produced with a page size of 66 by 132, six lines per inch, three copies, two file separator pages, and overflow at 60 lines.

The following chart explains this example:

Illustration of the example above.