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

102 Chapter4
Using the Database
Entering Data in the Database
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.