get_last



Summary

#include <dataman/dataman.h>

get_last(idx_name) else ...

char *idx_name;

Description

int db_g_last(idx_name)

This function retrieves the highest order key and its associated record from the named index, where idx_name is the name of the index that the last key is to be retrieved from. If the index is empty, the else clause is executed. If the named index is not empty the current record in memory is flushed, the index KP is set to the last 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»