HP 3000 Manuals

Deleting Data Entries [ TurboIMAGE/XL Database Management System Reference Manual ] MPE/iX 5.0 Documentation


TurboIMAGE/XL Database Management System Reference Manual

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 adding entries to 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.

For additional information, refer to the discussion of DBDELETE in
chapter 5 and the description of the DBUTIL >>ENABLE command in chapter
8.

Access Modes and User Class Numbers 

To update data items, the database must be opened with access mode 1, 3,
or 4.  If it is opened with access mode 1, the DBLOCK procedure must be
used to lock the detail data entry, data set, or database before an entry
can be deleted and DBUNLOCK should be called after one or all desired
entries have been deleted.  As a general rule, the lock should be
established before the whole delete sequence, that is, before the call to
DBGET that establishes which record is to be deleted.  This will ensure
that another user does not delete the data entry between the call to
DBGET and the call to DBDELETE.

An entry cannot be deleted from a data set unless the user has write
access to the data set.  Write access to the data set means the database
was opened in a write access mode and the user class number associated
with the DBOPEN password is on the set write class list.



MPE/iX 5.0 Documentation