HP 3000 Manuals

Entering Data in the Database [ TurboIMAGE/XL Database Management System Reference Manual ] MPE/iX 5.0 Documentation


TurboIMAGE/XL Database Management System Reference Manual

Entering Data in the Database 

Data is added to the database, one entry at a time, using the DBPUT
procedure.  You can add data entries to manual master and detail data
sets.  Entries are automatically added to automatic master data sets when
you add entries to the associated detail data sets.

To add an entry, you specify the data set name or number, a list of data
items in the set, and the name of a buffer containing values for these
items.  Values must be supplied for search and sort items but are
optional for other data items in the entry.  If no value is supplied, the
data item value is set to binary zeroes.

Sequence for Adding Entries 

Before you can add an entry to a detail data set indexed by a manual
master data set, the manual master must contain an entry with a key item
value equal to the search item value you intend to put in the detail.  If
more than one manual master is used to index the detail, entries that
have a key item value identical to the detail search item value for the
same path must exist in each master.  To illustrate, consider the ORDERS
database again.  Figure 4-1  contains sample data entries in four of
the ORDERS data sets.

Before the SALES data entry can be added to the data set, the CUSTOMER
manual master data set must contain an entry with ACCOUNT equal to
12345678 because ACCOUNT is the search item used to index the SALES
detail.  Similarly, the SALES data set is indexed by the PRODUCT manual
master through the STOCK# search item, so the entry with STOCK# equal to
34624AB3 must be added to PRODUCT before a sales transaction for that
STOCK# can be entered in SALES.

Once the entry for customer account 12345678 has been entered, the next
sales transaction can be entered in the SALES detail set without changing
the CUSTOMER master.  This entry will be chained to the previous entry
for the account.  If a different customer buys a bicycle tire pump, the
PRODUCT data set will not require any additional entries, but if the
customer's account is not yet in the CUSTOMER data set, it must be added
before entering the sales transaction in SALES.

When the entry for account 12345678 and stock number 35624AB3 is added to
SALES, TurboIMAGE/XL automatically adds entries to the DATE-MASTER with a
DATE item value of 910927 and 910928 if such entries do not already
exist.  If the entries do exist, each chain head is modified to include
the entry added to the chain.

[]
Figure 4-1. Sample Data Entries from ORDERS Database Coordinating Additions to a Database A single DBPUT call involves chain maintenance and other activity that can span multiple data sets and multiple blocks within data sets even if an application is only adding entries to a single data set. TurboIMAGE/XL coordinates calls to DBPUT to ensure that one database user's DBPUT activity does not interfere with calls made by other users accessing the same database. Each DBPUT request finishes processing before TurboIMAGE/XL moves on to the next one. DBPUT calls are serialized even if they access unrelated data sets. TurboIMAGE/XL provides a data prefetching option to enhance DBPUT (and DBDELETE) processing. You can enable this option with the DBUTIL utility and are recommended to do so only when all of the following conditions are true: * Multiple processes are accessing the database. * The processes are adding data with the DBPUT intrinsic (or deleting data with the DBDELETE intrinsic). * Adequate CPU and memory resources are available on your system. For additional information, refer to the discussion of DBPUT in chapter 5 and the description of the DBUTIL >>ENABLE command in chapter 8. Access Mode and User Class Number An entry cannot be added to a data set unless the user class number established when the database is opened grants write access to the data set. The user class number must be in the data set write class list. The database must also be opened with an access mode allowing entries to be added. These access modes are 1, 3, and 4. If it is opened with access mode 1, the DBLOCK procedure must be used to establish a lock covering the entry to be inserted. For detail data sets, this can be a data entry, data set, or database lock. For master data sets, this can be a data set or a database lock. Note that the locking mechanism accepts a request to lock a data entry that does not yet exist; therefore, you can lock a data entry before you add it. Key and Search Items TurboIMAGE/XL performs checks on the values of detail data set search items before adding an entry to a data set. When adding records to a manual master, TurboIMAGE/XL verifies that the master data set key item value is unique for the set (that is, no entry currently contains a key item with the same value). If the data set is a detail, TurboIMAGE/XL verifies that the value of each search item forming a path with a manual master has a matching key value in that master. It also checks to be sure that room is available to add an entry to any automatic master data sets linked to the detail if a matching search item value does not exist.


MPE/iX 5.0 Documentation