Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic


A Low-Level FairCom Server enhanced version of the ctVERIFY() function. It can be called in either client or standalone mode.

Function Name

NINT ctVERIFYidx(COUNT keyno, pctVFYIDXin pvfyin, pctVFYIDXout pvfyout);


Low-Level file function


  • keyno is the file number of an index files that the caller has opened.
  • pvfyin points to an input parameter structure. (ctVFYIDXin; see ctport.h)
  • pvfyout points to an output parameter structure containing index statistics returned by the function. (ctVFYIDXout see ctport.h)

Review ctvfyidx utility source code for an example demonstrating a call to the ctVERIFYidx() function.

ctVERIFYidx() calls the progress callback function with the start bit before its first call to the message callback function.

In V10.3.1 and later, ctVERIFYidx requires the file to be open in ctEXCLUSIVE mode or in ctREADFIL (read only) mode to ensure it does not incorrectly report errors if other users make changes while the verification is running. Opening with ctSHARED will fail with LERR_ERR. A ctREADFIL open will fail with error 12 and sysiocod ‑8 if any connection has the file open for write access.

A call is made to CTFLUSH on the index prior to leaf verification to ensure all changes are on disk. In some cases, such as for SUPERFILE members, CTFLUSH can fail. An error message is logged, but the verification will continue. In this case, a VRFY_ERR could indicate the existence of updated index nodes in cache. The application should ensure that the data has been properly flushed.

Input parameters

typedef struct ctvfyidxin {

LONG verson; /* version of this structure */

LONG action; /* operations to perform, see below */

LONG maxnod; /* maximum node counts in output buf */

TEXT flags; /* options to pass to server */

TEXT pad[3]; /* padding */

pVFYMSGCBFNC fnmessage; /* optional message callback function */

pVFYPRGCBFNC fnprogress; /* optional progress callback func */

} ctVFYIDXin, *pctVFYIDXin;

ctVFYIDXin.action is a bitmask of the following options:

#define ctVFYIDXdelstk 0x00000001 /* check delete stack */

#define ctVFYIDXlink 0x00000002 /* check links */

#define ctVFYIDXleaf 0x00000004 /* check leaf nodes */

#define ctVFYIDXchkkey 0x00000008 /* check keys in leaf nodes */

#define ctVFYIDXspace 0x00000040 /* analyze space usage. physical index only - added V12 */

The following fields should be initialized to a macro or fixed value.

ctVFYIDXin.verson = ctVFYIDX_VERS_CUR;

ctVFYIDXin.maxnod = VFYLEV;

ctVFYIDXin.flags = 0;

As of V12 current version is ctVFYIDX_VERS_V02.

Output parameters

typedef struct ctvfyidxout {

LONG smtynod; /* number of empty nodes */

LONG sbadnod; /* number of bad nodes */

LONG sununod; /* number of unused nodes */

LONG sresnod; /* number of resource pages */

LONG smisnod; /* number of misaligned nodes */

LONG sbadlnk; /* number of bad links */

LONG lostnod; /* number of lost nodes - added V12 */

LONG snodcnt[VFYLEV]; /* node count at each level of tree */

} ctVFYIDXout, *pctVFYIDXout;


ctVERIFYidx() returns NO_ERROR on success or a non-zero error code on failure. Error code VRFY_ERR (601) indicates that the verification ran to completion but it detected one or more discrepancies.

The client-side progress function can return a non-zero error code to cause the c-tree Server to terminate the index verify operation. In that case, ctVERIFYidx() returns error code VFYTRM_ERR (910, a user-defined callback function terminated the index verify operation).

When a user-defined ctVerifyFile() error callback function returns a non-zero error code so that it can cancel the verification operation, ctVerifyFile() returns the c-tree error code and system error code for the error that triggered that call to the error callback function.

VFYVER_ERR (909) is returned if a client compiled with this change calls ctVERIFYidx() against an older server while specifying ctVFYIDX_VERS_V02. It is possible to obtain backwards compatibility by having the new client specify ctVFYIDXin.version = ctVFYIDX_VERS_V01, and providing a pvfyout buffer of the older type, now available as: typedef struct ctvfyidxout_v1 ctVFYIDXoutV1. Older clients will continue working with newer servers.

See Also

ctVerifyFile (ctVerifyFile, ctVerifyFile)