to the ￿le, and attempt to sa ve the ￿le as OLD. A directory error (for example, a duplicate ￿le name) can be detected only at close time; and data is lost, unless y ou have used one of the following methods to c heck for or avoid the situation:

Create a NEW ￿le by using BUILD before executing the program in whic h the ￿le is opened as an OLD ￿le.

Delete the previous cop y of the ￿le before the run. Rename the existing ￿le b y using FRENAME .

The File System closes ￿les when it terminates a program, without requiring the program to explicitly close them. This allo ws no recourse for acciden tally losing data. It is a recommended programming practice, when the con tent of a ￿le is important, to write the program to properly handle closing disposition.

The CREATE domain of HPFOPEN creates a NEW ￿le and makes it PERMANENT when closed. It eliminates the need to HPFOPEN or FOPEN it as a NEW ￿le, HPFCLOSE or FCLOSE it as a PERMANENT ￿le, and open it with HPFOPEN or FOPEN again as an OLD ￿le.

Changing Domains

A ￿le's domain can be c hanged. Any disc ￿le can be made permanen t or can be deleted after it has served its purpose. You can use the disposition parameter of the FCLOSE intrinsic to specify a di￿eren t domain for a ￿le as it closes. Y ou can use the :FILE command to change the domain of a ￿le; specifying the DEL, TEMP, or SAVE parameter determines the disposition of a ￿le when it is closed after its next use. The DEL parameter deletes a ￿le after its next use. The TEMP parameter changes the domain of a NEW ￿le to TEMP when it is closed. The SAVE parameter changes the domain of a NEW or TEMP ￿le to PERMANENT when it is closed.

You can change the domain of a ￿le from TEMP to PERMANENT without opening and closing the ￿le by using the :SAVE command. This command prompts y ou for the lockword if the ￿le has one.

For examples of changing domains, refer to Accessing Files Programmer's Guide

(32650-90017). F or detailed information on the :FILE and :SAVE commands, refer to the MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364).

File Specifications

File speci￿cations allow y ou to identify a ￿le. This is necessary in order to: Locate it in the directory structure

Refer to it from a command or program

Determine how to handle it during ￿le manipulations suc h as opening and closing

Transfer it during I/O

The File System uses sev eral designations and classi￿cations to facilitate ￿le iden ti￿cation. The use of ￿le designators and classes allows the File System to recognize a ￿le so that commands and programs can reference it. MPE/iX allo ws you to designate a name for a ￿le in several ways. Techniques for ￿le identi￿cation are described in the subsections belo w.

6-8 File System