Overriding file attributes
The simplest form of overriding a file is to override some attributes of the file.
File attributes are built as a result of the following actions:
- Create file command. Initially, this command builds the file attributes.
- Program using the files. At compilation time, the user program can specify some of the file attributes. The high-level language used by the program determines the attributes that can be used.
- Override commands. At program run time, 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.
For example, assume that you create a tape file OUTPUT whose attributes are:
The Create Tape File (CRTTAPF) command looks like this:
- Use Device TAP01.
- Write the Data on the tape with a density of 1600 bits per inch (bpi)
- Use the ASCII character code type.
- When you close the tape file, the program rewinds and unloads the tape.
CRTTAPF FILE(QGPL/OUTPUT) DEV(TAP01) DENSITY(1600) CODE(*ASCII) ENDOPT(*UNLOAD)Your application program has the tape file OUTPUT specified with a character code type of EBCDIC and a density of 3200. However, before you run the application program, you want to change the density to 6250 bpi and the end option to *REWIND. The override command looks like this:OVRTAPF FILE(OUTPUT) DENSITY(6250) ENDOPT(*REWIND)When you call the application program, the system uses a tape density of 6250 bpi and the end option is *REWIND.
When the application program opens the file, the system merges these to form the open data path (ODP):
- The file overrides.
- The program-specified attributes.
- The file attributes.
The program uses the open data path (ODP) during the running of the program. File overrides have precedence overprogram-specified attributes. Program-specified attributes have precedence over file-specified attributes. In Figure 1, when you open the file and you perform output operations, the program writes:
- To the device TAP01 with a density of 6250 bpi.
- In a character code type of EBCDIC.
- An end option of *REWIND.
Figure 1 explains this example. Figure 1. Overriding file attributes
Parent topic:
Using overrides