Override of file attributes
Overriding file attributes is the simplest form of overriding a file. File attributes are built as a result of the following actions:
For example, assume that you create a printer file OUTPUT whose attributes are:
- Create file and add member commands. Initially, these commands build the file attributes.
- Program using the files. At compile time, the user program can specify some of the file attributes. (The attributes that you can specify depend on the high-level language in which the program is written.)
- Override commands. At the time when a program runs, these commands can override the file attributes previously built by the merging of the file description and the file parameters specified in the user program.
The Create Printer File (CRTPRTF) command looks like this:
- Page size of 60 by 80
- Six lines per inch
- Two copies of printed output
- Two pages for file separators
- Overflow line number of 55
CRTPRTF FILE(QGPL/OUTPUT) SPOOL(*YES) + PAGESIZE(60 80) LPI(6) COPIES(2) + FILESEP(2) OVRFLW(55)You specify the printer file OUTPUT in your application program with an overflow line number of 58 and a page size of 66 by 132. However, before you run the application program, you want to change the number of printed copies to 3, and the overflow line to 60. The override command looks like this:
OVRPRTF FILE(OUTPUT) COPIES(3) OVRFLW(60)Then you call the application program, and three copies of the output print.When the application program opens the OUTPUT file, the system merges the file-specified attributes, program-specified attributes, and override-specified attributes to form the open data path. The system uses the open data path when the program runs. The system merges file-specified overrides with the program-specified attributes first. Then it merges these merged attributes with the override attributes. In this example, when the OUTPUT 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, and two file separator pages. The spooled output will overflow at 60 lines.
Figure 1 explains this example. Figure 1. Override file attributes
Parent topic:
Application of overrides