get_prior



Summary

#include <dataman/dataman.h>

get_prior(idx_name) else ...

char *idx_name;

Description

int db_g_pror(idx_name)

This function retrieves the next lower order key and its associated record from the named index, where idx_name is the name of the index that the prior key is to be retrieved from. If the current key is the lowest order in the index, the else clause is executed. If the named index has a lower key the current record in memory is flushed, the index KP is set to that key, the MFRP is set to the associated record and that record is retrieved.

Example

    #include <dataman/dataman.h>

    main(argc,argv)
    {

        get_last(num_ix) else    /* get last account */
            fatal("Index %s is empty\n",num_ix);
        while (1) {
              ...                    /* process */
            get_prior(num_ix) else   /* next account */
                break;               /* end loop */
        }
    }


    This will loop through an entire index backwards.

«previous  next»