ResetRecord
Updates the current ISAM record image buffers.
Short Name
UPDCURI()
Type
ISAM function
Declaration
COUNT ResetRecord(COUNT datno, COUNT mode);
Description
ResetRecord() manipulates the internal image of the current ISAM record kept by c-tree. An image is kept of the current ISAM record’s key structure and the current ISAM record’s file address. Whenever an ISAM function changes the current ISAM record, such as an AddRecord() or ReWriteRecord(), the original current ISAM record information is copied over to a secondary buffer before the primary buffer is changed. ResetRecord() can be used to manage these two buffers.
mode |
Description |
SWTCURI |
Switches the ISAM buffers. Use SWTCURI after a rewrite to move the old buffer back to the original. This allows you to keep your position in the file as it was before the rewrite. |
SAVCURI |
Copies the current ISAM record information to the secondary buffer. |
RSTCURI |
Restores the primary ISAM record information from the secondary area. |
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
22 |
FNUM_ERR |
File number is out of range. |
26 |
FACS_ERR |
File number is not assigned to a file in use. |
47 |
FINT_ERR |
c-tree has not been initialized. |
48 |
FMOD_ERR |
datno is not assigned to a data file. |
116 |
IMOD_ERR |
Invalid value in mode. |
See c-tree Error Codes for a complete listing of valid c-tree error values.
Example
COUNT invfil;
struct invd {
TEXT delflg[4];
LONG part_no;
LONG on_hand;
TEXT part_name[60];
} recbuf;
scanf("%ld %59s %ld",&recbuf.part_no,recbuf.part_name, &recbuf.on_hand);
recbuf.delflg = '\0'; /* clear delete flag */
if (AddRecord(invfil,&recbuf) )
printf("\nAddRecord error %d in file %d", isam_err, isam_fil);
/* after adding record, restore current ISAM to previous point */
if (ResetRecord(invfil,SWTCURI) )
printf("\nCannot reset, error %d",isam_err);
See also
AddRecord(), ReWriteRecord(), SetRecord().