udfilcnt

Return the number of open operating system files

short udfilcnt (uc, drvnum, delta)

struct uctrl *uc;

short drvnum, delta;

Parameters

  • uc—pointer to the current uctrl structure.
  • drvnum—connector number (available in uctrl->udrvnum).
  • delta—number of files that have been opened (delta > 0) or closed (delta < 0).

Return Values

The new total number of open operating system files.

Description

Returns the number of open operating system files, which informs Uniface that the number of open operating system files has changed. If the connector or DBMS opens or closes one or more files, the connector must call udfilcnt within the execution of the same connector request.

Some DBMSs open more than one file per open table.

This example closes a file and adjusts the file count. Closing a file and adjusting the file count is usually performed for record-level connectors only. This example uses the RMS API. Error checking is not performed.

The following functions are called in the example:

  • EmbeddedFetch—fetches the next record from the specified (open) cursor and updates the values in SQLDA.
  • NoRecordCache—determines whether the select cache needs to be used.
  • BindKeys—updates the control block with lengths of actual fetched data for key fields.
  • BindAllFields—updates the control block with lengths of actual fetched data for all fields.

This examples uses the ufilblk data structure, which is dependent on the API you are using.

CloseTable ( struct uctrl *ControlBlock )
{
struct ufilblk *TableDescr;
long Status;
TableDescr = (struct ufilblk *)ControlBlock->udrv;
/* Description of table is stored */
/* in work area in control block. */
Status = sys$close ( &TableDescr->ufab );
/* Depends on the API of your system. */
if ( Status & 1 )
{ udfilcnt ( ControlBlock, ControlBlock->udrvnum, -1 );
}
else
{
/* Some actions to process the error. */
}
}