In addition to being used as input from and output to your terminal,
data sets are stored on a variety of auxiliary storage media, including magnetic
tape and direct access storage devices (DASDs). Despite their variety, these
media have characteristics that allow common methods of collecting, storing,
and transmitting data. The organization of a data set determines how data
is recorded in a data set and how the data is subsequently retrieved so that
it can be transmitted to the program. Records are stored in and retrieved
from a data set either sequentially, on the basis of successive physical or
logical positions, or directly, by the use of keys specified in data transmission
statements.
PL/I supports the following types of data set organizations:
- Consecutive. In the consecutive data set organization, records are organized
solely on the basis of their successive physical positions. When the data
set is created, records are written consecutively in the order in which they
are presented. The records can be retrieved only in the order in which they
were written.
- Indexed. In the indexed data set organization, records are placed in a
logical sequence based on the key of each record. An indexed data set must
reside on a direct-access device. A character string key identifies the record
and allows direct retrieval, replacement, addition, and deletion of records.
Sequential processing is also allowed.
- Relative. In the relative data set organization, numbered records are
placed in a position relative to each other. The records are numbered in succession,
beginning with one. A relative data set must reside on a direct-access device.
A key that specifies the record number identifies the record and allows direct
retrieval, replacement, addition, and deletion of records. Sequential processing
is also allowed.
- Regional. The regional data set organization is divided into numbered
regions, each of which can contain one record. The regions are numbered in
succession, beginning with zero. A region can be accessed by specifying its
region number, and perhaps a key, in a data transmission statement. The key
specifies the region number and identifies the region to allow optimized direct
retrieval, replacement, addition, and deletion of records.
The data set organizations differ in the way they store data and in the
means they use to access data.