Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

resetIDfield

Resets the IDENTITY value assigned to a DODA field.

Declaration

NINT resetIDfield(FILNO datno, LONG8 nxtval)

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

resetIDfield() resets an IDfield (IDENTITY) auto-numbering value for a numeric field in a record to a new specified value.

Where:

  • datno is the data file number
  • nxtval is the next value to be assigned on record addition

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

Return

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 = resetIDfield(fileno, 1000);

if (retval) {

printf("\tERROR: Failed to reset ID field with error %d\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(), wchIDfield(), IDfields - Extended support

TOCIndex