Accessing Files Programmer's Guide (32650-90885)

109
7 Record Selection and Data Transfer
The chief activities of the file system involve the transfer of data. In this chapter we will
examine how this is accomplished. As you read this chapter, keep these considerations in
mind:
How are records selected for transfer?
What intrinsics are used for data transfer?
How is the record pointer affected by intrinsics?
The last section of this chapter discusses the major points presented in this chapter as
they pertain to magnetic tape files.
Record Pointers
The file system uses record pointers to find specific records for your use. Physical record
pointers (also referred to as block pointers) are used to locate specific blocks on disk; logical
record pointers blocks and deblocks the logical records in a physical record and indicate
specific logical records within a file. A file opened with the
inhibit buffering option
parameter set to BUF (the default) is accessed with a logical record pointer. A file opened
with the
inhibit buffering option
parameter set to NOBUF is accessed with a physical
record (or block) pointer.
Figure 7-1. shows how the physical and logical record pointers operate together to locate
any record in a file. For any record, the physical record pointer indicates the correct block,
and the logical record pointer locates the logical record within the block.
The file system uses both the physical and the logical record pointers to locate records.
Future references to "record pointer" in this manual will imply this combination.
When you open your file the HPFOPEN/FOPEN intrinsic sets the record pointer to record 0
(the first record in your file) for all operations. If you have opened the file with APPEND
access, though (using the
access type option
parameter available in HPFOPEN/FOPEN),
MPE/iX moves the record pointer to the end of the file prior to a write operation; this
ensures that any data that you write to the file is added to the end of the file rather than
written over existing data.