dfindpm - find previous matching record using secondary index


#include <cbase/dirio.h>

rno_t dfindpm(buffer, fcb)

char *buffer;

DFILE *fcb;


Dfindpm searches for duplicate secondary keys in reverse secondary key order. Before calling dfindpm, call dseti(C-3) to select the desired secondary index. Call dfindlm(C-3) to find the last key value in the secondary index. Each subsequent call to dfindpm returns the previous record in reverse secondary key order whose keys match the record returned by dfindlm(C-3). If dnumidx(C-3) has been called prior to this function, only the first n fields of the current index are compared; otherwise, all fields of the current index are compared. The beginning contents of buffer are ignored by dfindpm.

Dfindpm maintains the current position in the secondary index, so additional records may be fetched in reverse secondary key order by calling the dfindpm function repeatedly.

Fcb is the file block pointer returned by dlopen(C-3) or dopen(C-3).

The returned record number may be saved and used on a subsequent call to dread(C-3).


dlopen(C-3), dopen(C-3), dseti(C-3), dfindlm(C-3),

dnumidx(C-3), dread(C-3)

Chapter 4,

RMS Programming Guide


Dfindpm returns a value of BAD (-1) if an I/O error occurred or if there is no record that contains field values equal to the last values returned. If no record is found, the contents of buffer are undefined.