Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

getIDfield

Return IDENTITY attribute information from a file.

Declaration

NINT getIDfield(FILNO datno, NINT mode, pLONG8 retval)

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

getIDfield() returns information about an IDfield (IDENTITY) value.

Where:

  • datno is the data file number
  • mode is the next value to be assigned to the field on add.
  • retval is the value to increment each addition.

mode can take one of the following values:

  • updateValue - return is set to the next IDfield value, and the IDfield is updated
  • reportValue - return is set to the next IDfield value, but the IDfield remains unchanged
  • startingValue - return is set to the starting value for the IDfield
  • deltaValue - return is set to the IDfield change value (delta in IDfield)

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 FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Example

retval = getIDfield(fileno, reportValue, &idval);

if (retval) {

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

}

else

printf("Next IDENTITY value is %d\n", idval);

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(), wchIDfield(), resetIDfield(), IDfields - Extended support

TOCIndex