D Eloquence Library

The DELETE Function

The DELETE function deletes an entry from the database. The syntax is as follows:

   idb_delete(base,dset,mode,status)

   int base;
   void *dset;
   int mode;
   int status[10]
The parameters are:

base
Identifies the database. This must be the return value from the idb_open call.
dset
Identifies the data set in which the entries are to be located. Dset is one of the following:
* a pointer to an integer variable that specifies the data set number;

* a pointer to a character array containing up to 16 characters (bytes) that specifies the data set name. The data set name must be terminated with a semicolon, a blank or 0 character if it is less than 16 characters.

mode
Must be 1.
status
A pointer to an array of a least 10 elements used to indicate the success or failure of the function call (see below).

Description

Idb_delete deletes the current record from the specified data set. The database must be open in either mode 1 or mode 3. The security class number must have write access to the data set specified in dset.

If the entry being deleted is part of a chain, all links are automatically maintained. If the entry is the last entry in a chain and the chain is linked to an automatic master, the entry in the automatic master is deleted unless it is linked to any other chains. An entry in a manual master can only be deleted if all linked child entries are deleted first.

Idb_delete does not affect the current chain or the chain information in the status parameter.

Return value

Returns 0 if successful, or error number if an error was encountered.

Status codes

If idb_delete was successfully executed, the status array will contain the following values:

       [0] = S_OK    [6] = 0
       [1] = record length   [7] = backward address
       [2] = 0     [8] = 0
       [3] = record number   [9] = forward address
       [4] = 0
       [5] = 0 if a detail set, 1 if master set

Example

   if(idb_delete(dbid,"CUSTOMER",1,status))
      error_handler();
This will delete the current record from the CUSTOMER data set.


Eloquence Database Manual - 19 DEC 2002