D Eloquence Library

The CLOSE Function

The CLOSE funtion terminates access to a database or resets the current record for a data set. The syntax is as follows:


   int cc = idb_close(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
This parameter is ignored if mode is not equal to 3. Identifies the data set to be rewound. 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
See below.
status
A pointer to an array of a least 10 elements used to indicate the success or failure of the function call.

IDBCLOSE Modes

Mode 1. Close database

Terminate access to the database and deallocate resources.

Mode 3. Rewind data set

The current record of the given data set is reset to zero.

Description

Idb_close terminates access to a database or resets current record for a data set. If a program has issued multiple calls to idb_open for the same database, only the access path of the given base parameter is affected.

Idb_close does the following:

Return value

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

Status codes

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

Status codes
ElementMeaning
0S_OK
10
20
30
40
5DB_CLOSE | (open_mode << 12)
60
70
8mode
90

Example

   if(idb_close(dbid,"CUSTOMER",3,status))
      error_handler();
This will rewind CUSTOMER data set.


Eloquence Database Manual - 19 DEC 2002