If the process issues more than one HPFOPEN or FOPEN call for a ￿le before it is closed, it results in m ultiple, logically separate accesses of that ￿le. In this case, MPE/iX returns a unique ￿le number for each access and maintains a separate logical record poin ter. (indicating the next sequential record to be accessed) for eac h access where you did not request or permit the multi-access option at HPFOPEN or FOPEN time.

When you open a ￿le, HPFOPEN or FOPEN establishes a comm unication link between the ￿le and your program. The link is established b y determining the device on whic h the ￿le resides, allocating it to y our process, verifying access righ t, and performing other required tasks.

These tasks include constructing con trol blocks required by MPE/iX for access to this ￿le. F or detailed information on establishing the comm unication link and determining the File System hierarchy, refer to Accessing Files Pr ogrammer's Guide (32650-90017).

For an example of opening new and old disc ￿les, refer to Accessing Files Pr ogrammer's Guide (32650-90017).

When a process opens a disc ￿le, the HPFOPEN or FOPEN call speci￿es that the ￿le is OLD (located in either the System P ermanent File Directory or the Job T emporary File Directory) or NEW. An OLD ￿le is an existing ￿le, and a NEW ￿le is a ￿le to be created during the process. When a process accesses a ￿le residing on a non-sharable device, the device's attributes ma y override the OLD or NEW speci￿cation. Speci￿cally, a device used only for input automatically imposes a PERMANENT domain on a ￿le. A device used only for output, suc h as a line printer, automatically imposes a NEW domain on a ￿le. Serial input/output devices, suc h as terminals and magnetic tape units, follo w the domain option speci￿cation in the HPFOPEN or FOPEN call.

Note

The HPFOPEN intrinsic assumes that all ￿les on non-sharable devices (device

 

￿les) are PERMANENT ￿les. To maintain compatibility with MPE V/E, device

 

￿les can be opened with the domain option set to NEW, but a warning is

 

returned in the status parameter.

 

 

When a job attempts to open a PERMANENT ￿le on a non-sharable device, MPE/iX searc hes for the ￿le in its in ternal tables. If it does not ￿nd the ￿le, it requests the operator to locate the ￿le. When a job opens a new ￿le on a non-sharable device (other than magnetic tape), it uses the ￿rst a vailable device. When a job opens a new ￿le on a magnetic tape unit, the operator is usually required to mak e the tape available. The speci￿cation of a device name or device class when HPFOPEN or FOPEN is issued, implies a request for the initial allocation of an unopened device.

For detailed information on, and examples of, opening a ￿le on a non-sharable device, refer to Accessing Files Pr ogrammer's Guide (32650-90017).

Closing a File

You terminate access to a ￿le from a program with the FCLOSE intrinsic. It applies to ￿les on all devices (disc ￿les and device ￿les) and deallocates the device on whic h the ￿le resides. If your program has sev eral concurrent HPFOPEN or FOPEN calls issued to the same ￿le, the device is not deallocated un til the last FCLOSE intrinsic is executed.

You can use the FCLOSE intrinsic to change the disposition of a disc or magnetic tape ￿le. F or example, a ￿le you open as a NEW ￿le can be closed and sa ved as an OLD ￿le with permanen t or temporary disposition. A disc ￿le y ou open as a TEMP ￿le can be closed as TEMP or saved as a PERMANENT ￿le.

File System 6-17