forward



Summary

#include <dataman/dataman.h>

forward(idx_name) else ...

char *idx_name;

Description

int db_fwd(idx_name)

The forward function retrieves the next record from a database file. The function checks the named index's MFRP. If it points to nothing, the diagnostic "Initial GET not attempted" is displayed, and the process terminates. If a record follows the one pointed to by the index, the last accessed record is flushed to disk, the index's MFRP is incremented, and the new current record is read into memory. This should not be confused with the get_next function. If the MFRP points to the last record in a particular file the current record is NOT flushed, and the else clause is taken. If idx_name is the manifest constant WFILE this signifies that the file to be operated on is the 'work file', instead of an index file.

Example

    #include <dataman/dataman.h>

    main(argc,argv)
    {

        key k_buff;
          ...
        get(idx1,k_buff) else {    /* get a format 2 */
            pause(10,10,"Can't get key");
            exit(0);
        }
        do {
              ...                  /* process rf 2 */
            forward(idx1) else     /* get to next record */
                break;             /* at EOF */
        } while (MFMT == 2);       /* do format 2 recs */
    }

«previous  next»