dfindpi - find previous record using secondary index


#include <cbase/dirio.h>

rno_t dfindpi (buffer, fcb)

char *buffer;

DFILE *fcb;


Dfindpi reads a record from an RMSfile in reverse secondary key order. Before calling dfindpi, call dseti(C-3) to select the desired secondary index. Dfindi(C-3), dfindli(C-3), or dsetpos(C-3) can be called to set the starting point in the secondary index. Each subsequent call to dfindpi returns the previous record in secondary key order. The beginning contents of buffer are ignored by dfindpi.

Dfindpi maintains the current position in the secondary index, so additional records may be fetched in reverse secondary key order by using the dfindpi 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), dfindli(C-3), dfindi(C-3),


Chapter 4,

RMS Programming Guide


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