TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)
42 Chapter2
Database Structure and Protection
Data Set Types and Relationships
Because a detail data set can contain as many as 16 search items, it can be related to at
most 16 master data sets. Each master-to-detail relationship must be relative to a different
detail search item. The SALES data set is related to the CUSTOMER, PRODUCT, and
DATE-MASTER data sets.
A detail data set can be multi-indexed by a single master data set. For example, SALES is
indexed twice by DATE-MASTER. The DATE search item forms one path with the
PURCH-DATE search item and one path with the DELIV-DATE search item. Each master
data set can serve as an index to one or more detail data sets. No master data set can be
related to more than 16 detail data sets. For each such relationship, TurboIMAGE/XL
keeps independent chain information with each master entry. This information consists of
pointers to the first and last entries of the chain whose search item value matches the
master data set entry's key item value and a count of the number of entries in the chain.
This is called a chain head. The format of chain heads is given in chapter 10. For
example, the DATE-MASTER data entries each contain two sets of pointers, one for
PURCH-DATE chains and one for DELIV-DATE chains. TurboIMAGE/XL automatically
maintain the chain heads.
Primary Paths
One of the paths of each detail data set can be designated by the database designer as the
primary path. The main reason for designating a primary path is to maintain the entries
of each chain of the path in contiguous storage locations. To maintain contiguous locations,
occasionally use the DBUNLOAD utility program to copy the database to tape, the DBUTIL
utility program to erase the database, and the DBLOAD program to reload the database from
the tape. When the database is reloaded, contiguous storage locations are assigned to
entries of each primary path chain. Therefore, the database designer should designate the
path most frequently accessed in chained order as the primary path. This type of access is
discussed in chapter 5.
A primary path also serves as the default path when accessing a detail data set if no path
is specified by the calling program. This characteristic of primary paths is described with
the DBGET procedure in chapter 5.
Sort Items
For any path, it is possible to designate a data item other than the search item as a sort
item. If a sort item is specified, each of the chains of the path are maintained in ascending
sorted order based on the values of the sort item. Different paths can have different sort
items, and one path's sort item can be another path's search item. Only data items of type
logical or character can be designated as sort items.
For example, chains in the SALES data set composed of entries with identical ACCOUNT
values are maintained in sorted order by PURCH-DATE. When information about sales to
a particular customer is required, the SALES data entries for that customer's account can
be retrieved in sorted order according to purchase date. PURCH-DATE is a meaningful
sort item because the dates are stored in a properly form for collating (year-month-day).
The sorted order of entries is maintained by logical pointers rather than physical
placement of entries in consecutive records. Figure 2-4. illustrates the way that
TurboIMAGE/XL maintains sorted paths. When an entry is added to a detail data set, it is
added to or inserted in a chain. If the path does not have a sort item defined, the entry