Creating a File

When creating a ￿le, y ou choose physical characteristics for it based on ho w the ￿le will be used. These physical characteristics are determined b y parameters y ou choose when you:

Create the ￿le with the HPFOPEN intrinsic, FOPEN intrinsic, or the :BUILD command.

Specify the ￿le with the :FILE command.

Once a ￿le has been created, y ou cannot change its physical characteristics. You can change other characteristics b y rede￿ning them each time you open the ￿le. The :FILE command, HPFOPEN intrinsic, and FOPEN intrinsic can alter the w ay a ￿le is to be used.

The physical characteristics include record format, record size, v olume class, and man y other attributes. The in trinsics and commands for specifying the ph ysical characteristics of a ￿le are described belo w. (For detailed information on creating a ￿le, refer to Accessing Files Programmer's Guide (32650-90017).

HPFOPEN and FOPEN Intrinsics

The HPFOPEN intrinsic is a programmatic tool that establishes access to a disc or device ￿le and enables you to create a ￿le on a sharable device. Its optional parameters are a superset of the options in the F OPEN intrinsic and provide more e￿cient ￿le access. You can use HPFOPEN parameters to specify record format, record size, v olume class, and man y other physical characteristics. HPF OPEN and FOPEN allow ￿le names to include command interpreter (CI) variables and expressions.

When a previously non-existen t ￿le is created at run-time, the File System m ust set up the physical characteristics of a NEW ￿le. You can use a :FILE command to specify the ph ysical characteristics of a NEW ￿le. These override any system defaults and an y speci￿cations giv en in the program or subsystem when it opens the ￿le because no ￿le label has been de￿ned for this NEW ￿le. If you want to keep the NEW ￿le permanently, you should close it as a TEMP or PERMANENT ￿le. Otherwise, it is deleted when the program or subsystem terminates. Figure 6-14 sho ws an example of creating a ￿le.

Figure 6-14. Creating a File

File System 6-27