TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

Chapter 4 105
Using the Database
Reading the Data
Reading the Data
When you read data from the database, you specify which data set and which entry in that
data set you want. If the user class number with which you opened the database grants
you read access, you can read the entire entry or specific data items from the entry. You
specify the items to be read and the array where the values should be stored. You can read
items or entries in any access mode if your user class grants read access to the data
element.
To understand the various ways you can select the data entry to be read, it is important to
know a little about the data set structure. Each data set consists of one or more disk files
depending on whether or not the set is jumbo, and each data entry is a logical record in
that file. Each entry is identified by the relative record number in which it is stored. The
first record in the data set is record number 1 and the last is record number n, where n is
the capacity of the data set.
At any given time, a record may or may not contain an entry. TurboIMAGE/XL maintains
internal information indicating which records of a data set contain entries and which do
not.
Current Path
TurboIMAGE/XL maintains a current path for each detail data set and for each database
accessor (that is, each DBOPEN). The current path is established by the DBFIND procedure,
or if no call has been made to this procedure, it is the primary path for the data set. Each
time an entry is read, no matter what read method is used, TurboIMAGE/XL saves the
entry's backward and forward chain pointers for the current path. For more information
about how the current path is used, refer to the discussion of chained access later in this
chapter.
If an entry is read from a master data set, the chain pointers are synonym chain pointers
and have no relationship to a path.
Reading Methods
The methods for requesting a data entry are categorized as follows:
Directed access
Serial access
Calculated access
Chained access
Sorted sequential access
All of these methods are available through the TurboIMAGE/XL library procedure DBGET.
The chained access method also requires the use of the DBFIND procedure. Figure 4-2.
illustrates the access methods using two data sets from the ORDERS database.