get_current



Summary

#include <dataman/dataman.h>

get_current(idx_name) else ...

char *idx_name;

Description

int db_g_curr(idx_name)

This function retrieves the current key from the named index, and it's associated record. If no get has yet been performed, the diagnostic "Initial GET not attempted" will appear and the program will exit. If the key that idx_name refers to has been removed, or the data record that the key points to has been deleted, the current record will not be flushed, and the else clause will be executed. If the key is found and the record exists, the current record will be flushed, and the record that current key in idx_name points to will be read into memory.

Example

    #include <dataman/dataman.h>

    main(int argc, char *argv[])
    {

        key k_buff;
          ...
        mk_key(k_buff, acct_no);
        get(num_ix, k_buff) else      /* get next acct */
            break;                    /* done with it */
        do {
            forward(num_ix) else      /* get next rec */
                break;                /* done with file */
              ...                     /* process record */
        } while (MFMT == 2);
        get_current(num_ix) else      /* get header rec */
            error();                  /* problem */
          ...
    }

«previous  next»