Accessing Files Programmer's Guide (32650-90885)

92 Chapter5
Opening a File
How the File System Opens a File
Determining that the file has not been allocated exclusively to another process (by the
exclusive option in an HPFOPEN/FOPEN call issued by that process).
Processing user labels (for files on disk). For new files on disk, HPFOPEN/FOPEN specifies
the number of user labels to be written.
Constructing the control blocks required by MPE/iX for this particular access of the file.
The information in these blocks is derived by merging specifications from four sources,
listed below in descending order of precedence (and illustrated in Figure 5-1.)
1. The file label, obtainable only if the file is an old file on disk; otherwise,
device-dependent characteristics applicable to the nonshareable device. This
information overrides information from any other source.
2. The parameter list of a previous FILE command referencing the same formal file
designator named in this HPFOPEN/FOPEN call, if such a command was issued in this
job or session. This is only true, if file equations were not disallowed.
3. The parameter list of this HPFOPEN/FOPEN intrinsic call.
4. System default values provided by MPE/iX (when values are not obtainable from the
above sources).
When information from one of these four sources conflicts with that from another,
preempting takes place according to the order of precedence illustrated in Figure 5-1. To
determine the specifications actually taking effect, you can call the FFILEINFO intrinsic.
Certain sources do not always apply or convey all types of information. For example, no file
label exists when a new file is opened, and so all information must come from the last four
sources above.
Figure 5-1. File System Hierarchy of Overrides
Since the physical characteristics of a disk file cannot be changed after it has been created,
it makes sense that the file label would take precedence over information from any other
source. Likewise, when a device file is opened, device-dependent characteristics override
information from any other source.