D Eloquence Library

The PUT Function

The PUT function adds an entry to the database. The syntax is as follows:

   idb_put(base,dset,mode,status,list,buf)

   int base;
   void *dset;
   int mode;
   int status[10]
   void *list;
   void *buffer;
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
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).
list
Usually specifies the data items for which values are to be retrieved from the buffer parameter and stored in the dataset. @ is the only character supported as list parameter, i.e. a value for every data item in the entry will be stored (in the order defined in the data set). list must be a pointer to a character array.
buffer
A pointer to a character array containing the values of all data items in the data set.

Description

Idb_put adds an entry to 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 written is part of a chain, then all links are automatically maintained. If the entry is the first entry in a chain and the chain is linked to an automatic master, the entry in the automatic master is added if it is not already linked to any other chains.

If index items are defined for the specified data sets, the index entries are automatically maintained.

An entry in a manual master may not have a duplicate search item value.

Return value

Returns 0 if successful, otherwise error code.

Status codes

If idb-put was successfully executed, the status array will contain the following values:

Status codes
ElementMeaning
0S_OK
1record length
20
3record number
40
50 if detail set, 1 if master set
60
7backward address
80
9forward address

Example

   if(idb_put(dbid,"CUSTOMER",1,status,"@",buf))
      error_handler();
This will add a record to CUSTOMER data set.


Eloquence Database Manual - 19 DEC 2002