Sequential And Direct Access Data Files; Logical And Physical Records - IBM 5110 User Manual

Apl
Table of Contents

Advertisement

108
SEQUENTIAL AND DIRECT ACCESS DATA FILES
Sequential access data files can be on tape or diskette: however,
direct access data files can only be on diskette. The data file is
specified as either a sequential access or direct access data file when
it is initially created (see Specifying the Operation to be Performed
later in this chapter).
All 5110 data files are created sequentially: that is, individual records
are written to the file in sequential order.
Data File
Record 1
Record 2
Record 3
Record 4
Record 5
After a data file is created, data can be read from the file as follows:
• For a sequential access file, the records are read in the same
sequence as the records were written to the file. For example, the
first and second record must be read before the third record can be
read. Also, if you want to read a record previous to the last record
read, you must start the operation over from the beginning of the
data file.
• For a direct access data file, you specify the record{s) that are to be
read from the data file. For example, you can specify that the fourth
record in the file be r.ead (without reading the previous three
records) then after the fourth record is read you can specify that the
second record in the file be read, and so on. Also, multiple records
can be read with one statement.
LOGICAL AND PHYSICAL RECORDS
A logical record is the individual record written to a data file. For
sequential access data files, the size of each logical record can vary.
For example, one logical record might require 10 bytes of storage and
the next logical record might require 20 bytes of storage. For direct
access data files, each logical record requires the same amount of
diskette storage. Generally, each logical record must be the same
shape and representation as the other logical records in the data file.
A physical record is a certain amount of tape or diskette storage. For
tape, a physical record is 512 bytes. For diskette, a physical record is
the same as the diskette sector size (128, 256, 512, or 1024 bytes).

Advertisement

Table of Contents
loading

Table of Contents