HPlogo Getting Started as an MPE/iX Programmer Programmer's Guide: HP 3000 Computer MPE/iX Computer Systems > Chapter 7 Data Management

TurboIMAGE/XL Data Base

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A database is a collection of logically related data in one or more files. The files contain both the data itself and structural information on how one piece of data relates to another. Pointers in the database allow access to the actual data and indexing across the multiple files in the database. A network database ties together fields containing information that may be relevant to a single transaction even though they physically reside in different records.

The terminology used to describe a database differs from that used to describe MPE/iX files. Table 7-2 “Data Base Terminology” shows the corresponding terms.

Table 7-2 Data Base Terminology

MPE/iXNetwork Data BaseRelational Data Base
   
field data item column
   
record data entry row (or tuple)
   
file data set table
   
file definition schema - - -
   
collection of files database database
   
application database applications database
   environment
   

 

A network database consists of data sets. The structure of the database is a schema, which the user writes. The schema is processed and kept in a special file called a root file, which is also part of the database. The term database application refers to a complete data processing application using a database management system and a database.

The database described in this chapter is a TurboIMAGE/XL data base. A TurboIMAGE/XL database has two types of data sets:

  • Detail set, which is a collection of related data entries, each of which contains one or more a forward pointers, one or more backward pointers, and the data itself. A standalone data set contains no pointers. TurboIMAGE/XL uses the pointer information to tie together all data entries whose search items have the same value.

  • Master set, which maintains indexing into detail data sets or into itself, if it is a manual master set. Indexing consists of a key data item.

A given network database can have many detail sets and many master sets.

A key data item is frequently called simply a key item. It uniquely identifies the related data entries in a master data set. A search item value is not necessarily unique. In a master set, a key item is the data item used to perform the search.

Master Set

Each master set entry contains a key item pointing to a subset of detail set entries, all with related values in a particular data item. Thus, you can quickly reference any subset of entries by finding its master key item (index pointer). Each master set can contain values for one detail data item to search. (In other words, it can have only one field as a key item.) However, each master set can provide indexing for a maximum of 16 detail sets by using a key item in the master set as an index for a maximum of 16 detail sets. Each detail set can be linked to 16 master sets and can contain a maximum of 16 searchable data items. A master set can be automatic or manual.

Chain Head

In a master set data entry, the key item and the data items accompanying it are called a chain head. It consists of:

  • A count number indicative of the number of detail entries with matching key item values.

  • The pointer to the last data entry in the detail set whose key item value matches the value of the master set key item.

  • The pointer to the first data entry in the detail set whose key item value matches the value of the master set key item.

  • The data itself.

In the detail set, the first and last data entry described by the pointers in the chain head are the beginning and ending of the chain of data entries in the detail set that have the same value for the associated data item as the master set key item. A chain can have a maximum of 2**31 data entries. If more than one master set references a particular detail set, additional pointers are made available in the detail set.

A chain can be searched in either a forward or backward direction. This is convenient, for example, in an application that adds new invoice numbers to an existing data set. Otherwise, you can follow the pointer directly to the last entry in the chain and add a new entry using a minimum of disc overhead. New entries are automatically added at the end of the chain, unless the chain is sorted. Although pointers occupy space, usually a database takes less space than the MPE/iX files it replaces. This is because the reduction in data redundancy can outweigh the internal overhead of maintaining a TurboIMAGE/XL database. Figure 7-4 “TurboIMAGE/XL Data Set Organization Example” shows an example of how chain heads in a master set are used in TurboIMAGE/XL data set organization.

Figure 7-4 TurboIMAGE/XL Data Set Organization Example

[TurboIMAGE/XL Data Set Organization Example]

Automatic Master Set

The characteristics of an automatic master set are:

  • Each data entry contains a chain head.

  • A data entry (record, in MPE/iX terms) can contain only the key item used as an index pointer.

  • TurboIMAGE/XL automatically updates the master set when modifications are made to the related detail sets. Changing a search item requires deleting the old one and adding the new one.

  • The master set is automatically done. Use of an automatic master set saves time when key item values are unpredictable or so numerous that it is not expedient to make manual additions and deletions of master data entries. However, it may introduce data redundancy.

Manual Master Set

A manual master set data entry can contain not only a key item, but additional data items that provide information in addition to the key item. The characteristics of a manual master set are:

  • Each data entry contains a chain head.

  • You must explicitly add or delete all data entries.

  • You must add a key item in a master set data entry before adding a related detail set data entry.

  • You must delete all related detail sets before adding a master set entry.

  • Allows control over data entries that an automatic master set does not.