PreviousInSet Read the previous data record in the current key value set. Short Name PRVSET() Type ISAM function Declaration COUNT PreviousInSet(COUNT keyno, pVOID recptr) Description PreviousInSet() reads the previous data record in the set of data records whose keys match the set created by an earlier set function call. If successful, this record becomes the current ISAM record for the associated data file. If an error occurs or no previous record exists in the set, the current ISAM record is not updated, and the current key value set becomes undefined. If the data file has variable-length records, only the fixed-length portion, defined by dreclen in the original call to CreateIFile(), is actually read into the buffer pointed to by recptr. If you wish to read the entire variable-length record into the same or a different buffer, issue a call to ReReadVRecord() after the call to PreviousInSet(). Note that ReReadVRecord() requires the size of the buffer area so that it can check if sufficient space is available. Notice that you do not directly identify the data file number involved. The ISAM parameter file described in “ISAM Functions” of the c-tree Plus Programmer’s Reference Guide contains the correspondence between the index file number and the associated data file. Return
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example COUNT keyfil; TEXT target[24],recbuf[320];
scanf("%23s",target);
LastInSet(keyfil,target,recbuf,strlen(target)); while (isam_err == NO_ERROR) {
process_data(); PreviousInSet(keyfil,recbuf); } Limitations No check is made to determine if recptr points to a region sufficiently large to accept a data record. If the area is too small, either code or data will be clobbered. See also FirstInSet(), NextInSet(), LastInSet(), PositionSet(), ChangeSet(), CreateIFile(), ReReadVRecord(), TransformKey() |
||||||||||||||||||||||||