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

Chapter 4 115
Using the Database
Deleting Data Entries
Deleting Data Entries
Data is deleted from the database using the DBDELETE procedure. You can delete entries
from manual master and detail data sets. Entries are automatically deleted from
automatic master data sets as explained below.
To delete an entry from a data set, you must first locate the entry to be deleted by reading
it with the DBGET library procedure, or the DBFIND and DBGET procedures if it is
advantageous to use chained access to locate the entry. You then call the DBDELETE
procedure specifying the data set name. TurboIMAGE/XL verifies that your password and
associated user class number allow you to delete the current entry of the specified data set.
Sequence for Deleting Entries
If the detail data entry deleted is the only member of a detail chain linked to an automatic
master, and all other chains linked to the same automatic master entry are empty,
TurboIMAGE/XL automatically deletes the master entry.
If the data entry is in a manual master data set, TurboIMAGE/XL verifies that the detail
chains associated with the entry's search item, if any, are empty. If not, it returns an error
condition to the calling program. For example, if a program attempts to delete the
SUP-MASTER entry in Figure 4-2. that contains a SUPPLIER value of H&S SURPLUS,
an error condition is returned because a three-entry chain still exists in the INVENTORY
detail data set.
To delete the CUSTOMER data set entry with ACCOUNT equal to 75757575, the program
can call DBGET in calculated access mode specifying the CUSTOMER data set and the key
item value 75757575. If the procedure executes successfully, the program then can call
DBDELETE specifying the CUSTOMER data set to delete the current entry, provided no
chains in the related SALES detail data set contain search item values of 75757575.
Coordinating Deletions from a Database
A single DBDELETE 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
deleting entries from a single data set. TurboIMAGE/XL coordinates calls to DBDELETE to
ensure that one database user's DBDELETE activity does not interfere with calls made by
other users accessing the same database. Each DBDELETE request finishes processing
before TurboIMAGE/XL moves on to the next one. DBDELETE calls are serialized even if
they access unrelated data sets.
TurboIMAGE/XL provides a data prefetching option to enhance DBDELETE (and DBPUT)
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 deleting data with the DBDELETE intrinsic (or adding data with the
DBPUT intrinsic).
Adequate CPU and memory resources are available on your system.