Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic


Returns the DODA field with the IDENTITY attribute set.


whcIDfield(FILNO datno)


wchIDfield() returns which DODA field has an IDfield (IDENTITY) auto-numbering attribute set.


  • datno is the data file number. 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

IDfields requires a DAR resource (Direct Access Resource) embedded in the file. The DAR is a specialized high-speed resource.


Returns the DODA index (zero based) for the IDfield (the fieldno passed into addIDfield()). On error, -1 is returned and uerr_cod is set.


Symbolic Constant





See c-tree Error Codes for a complete listing of valid c-tree error values.


retval = wchIDfield(fileno);

if (retval <0 ) {

printf("\tERROR: Failed to retrieve ID column with error %d\n", uerr_cod);



printf("Field %d is an IDENTITY column\n", retval);

Override IDENTITY Values

PUTHDR() using the ctIDfieldOverRide mode can turn on and off the ability to override the automatic IDfield values. The override is on a per user, per file basis. A nonzero hdrval turns on the override, and a zero hdrval restores the standard operation. When the override is on for a data file that supports an IDfield, then an add record operation does not fill-in the IDfield value. Whatever is passed in the record buffer is used for the IDfield. And a rewrite permits the IDfield value to change instead of generating the IDFL_CHG error. When the override is enabled, add record operations do not consume IDfield values.

See also

addIDfield(), delIDfield(), getIDfield(), resetIDfield(), IDfields - Extended support