Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

NbrOfRecords

Get the number of active records in fixed-length data file.

Short Name

DATENT()

Type

Low-Level fixed-length data file function

Declaration

LONG NbrOfRecords(FILNO datno)

Description

In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering

NbrOfRecords() returns the number of active data records for the fixed length data file designated by datno.

Each time a new record is added to the file, the count of active records is incremented. Each time a record is deleted, the active count is decremented. A record is added by the Low-Level function NewData() or the ISAM function AddRecord(). A record is deleted by the Low-Level function ReleaseData() or the ISAM function DeleteRecord().

Note: A huge file may return values greater than 4 GB. This function returns the low-order 4-byte word of the 8-byte number of keys. To get the high-order 4-byte word, call ctGETHGH(). A return of zero is not necessarily an error if there are exactly a multiple 4 GB worth of key values.

Return

If an error occurs or if there are no active data records, NbrOfRecords() returns a value of zero. Otherwise, NbrOfRecords() returns the number of active fixed data records in the data file. After a call to NbrOfRecords() returns a zero, check the value of uerr_cod: if uerr_cod is non-zero, an error condition was detected; otherwise, no active records are in the file. See c-tree Error Codes in the c-tree Programmer’s Reference Guide for a complete listing of valid c-tree error values.

Example

FILNO datno;


scanf("%d",&datno);

printf("\nThere are %ld active records in file #%d.",

NbrOfRecords(datno),datno);

ee also

NewData(), AddRecord(), DeleteRecord(), ReleaseData()

TOCIndex