Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

wchIDfield

Returns the DODA field with the IDENTITY attribute set.

Declaration

whcIDfield(FILNO datno)

Description

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

Where:

  • 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.

Return

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

Value

Symbolic Constant

Explanation

0

NO_ERROR

Success

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

Example

retval = wchIDfield(fileno);

if (retval <0 ) {

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

}

else

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

TOCIndex