Record Selection and Data Transfer

Data is transferred in the File System b y a mechanism including records, record poin ters, and the intrinsics for transferring them.

Record Pointers

The File System uses record poin ters to ￿nd speci￿c records for use. Record poin ters block and deblock records and indicate speci￿c records in a ￿le. A ￿le opened with the inhibit bu￿ering option parameter set to BUF (the default) is accessed b y using a record poin ter. (A ￿le opened with the inhibit bu￿ering option parameter set to NOBUF is accessed via a bloc k pointer.)

Note

Bu￿ering does not apply to ordinary disk ￿les.

Pointer Initialization

When you open a ￿le, the HPFOPEN or FOPEN intrinsic sets the record poin ter to record 0 (the ￿rst record in the ￿le) for all operations. If y ou have opened the ￿le with Append access (using the access type option parameter), MPE/iX mo ves the record pointer to the end of the ￿le prior to a write operation. This ensures that an y data you write to the ￿le is added to the end of the ￿le instead of written o ver existing data. (Append and other access t ypes are described later in this man ual.) Following initialization, the record poin ter can remain in position at the head of y our ￿le, or it can be mo ved by the intrinsics used in record selection (for example, FREAD, FWRITE , and FPOINT ).

Record Selection

Various File System in trinsics are designed to transfer records to and from ￿les. The record pointer indicates the speci￿c location where a ￿le can be accessed. Records can be transferred to or from this location, or the poin ter can be moved to another place in the ￿le y ou wish to access.

There are ￿ve methods of record selection for accessing a ￿le:

Sequential access, in whic h you transfer data to and from the place the record poin ter currently indicates.

Random access, in whic h you use FPOINT to move the record pointer before transferring data, or you use FREADDIR to choose it at access time.

Update access, in whic h you choose a record and write a new record o ver it.

RIO access, in which you access only records that are activ ated.

Mapped access is a special t ype of access available only through the HPFOPEN intrinsic, in which you bypass File System data transfer mec hanisms by referencing the ￿le b y using a pointer declared in y our program.

For detailed information on record selection methods and the in trinsics used for data transfer, refer to Accessing Files Pr ogrammer's Guide (32650-90017).

6-30 File System