GetSerialNbr Get current data file sequence number. Short Name SERIALNUM() Type Low-level data file function Declaration LONG GetSerialNbr(COUNT datno) Description GetSerialNbr() returns the current sequence number for data file datno used in ISAM applications using a SRLSEG key segment mode. Use ctGETHGH() to retrieve the high-word portion of an 8-byte sequence number. When the SRLSEG key segment mode is used in an index, each call to NewData() or NewVData() increments the sequence number in the header of the associated data file. Calls to AddRecord() and AddVRecord() automatically invoke NewData() and NewVData(), respectively. To manually manage serial numbers, use the OPS_SERIAL_UPD status_word described in the SetOperationState() function description. Return GetSerialNbr() returns a long integer containing the current sequence number. If an error occurs (such as data file not in use), GetSerialNbr() returns a zero value. Check uerr_cod for the error code. See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values. Example COUNT datno;
printf("\nCould not open data file with error %d", uerr_cod);
exit(2); } printf("\n Last used sequence number for MYDATA is %ld.",
GetSerialNbr(datno)); exit(0); Limitations Serial numbers are not guaranteed to be sequential. See also ctGETHGH(), NewData(), NewVData(), AddRecord(), AddVRecord(), SetOperationState and “ISAM Functions” in the c-tree Plus Programmer’s Reference Guide. |
|||