E@DBFINDPRV

Name

The E@DBFINDPRV call has the following format:

DN@<Logical>(E@DBFINDPRV)

where <Logical> identifies the database file and index to use to perform the E@DBFINDPRV call.

Description

Once you have defined a position in the file with a successful E@DBFINDGE, use the E@DBFINDPRV routine to process database records sequentially in reverse <Index> order. This routine reads the record preceding the current record for this index.

Using the API in a Program

You must precede E@DBFINDPRV with E@DBFINDGE.

E@DBFINDNXT and E@DBFINDPRV each require their own E@DBFINDGE calls to function properly; do not use together after a single E@DBFINDGE call.

Input Values

Field Description
<Logical> <Logical> identifies the database file and index to use to perform the call.

Return Values

Field Description
D<prefix>@NOTFOUND

Each routine sets the logical value <FileName>-NOTFOUND or <FileName>-FOUND based on the outcome of the read process.

The Find routines set D<prefix>@NOTFOUND to FALSE if a record is found, TRUE if a record is not found, or E@KEY@FOUND if the keys are found.

Programming Example

This example shows a way to move backward and forward in a file depending on the action being processed. In this example, the index key to be used is set, the action code is checked, and the routine gets either the next record or the previous record.

Notice that the E@DBFINDGE call is made separately for each type of action code.

***   The action codes "N" and "P" are used to indicate that
***   the next or previous record is desired, respectively.

     EVAL      D@CMPNY        = F1@OECOMP        
     IF        F1@FC = 'N'                       
     CALLP     DN@DBBLOEC1(E@DBFINDGE)           
     IF        DOEC@NOTFOUND = FALSE             
               AND DOECCMPNY = D@CMPNY           
     CALLP     DN@DBBLOEC1(E@DBFINDNXT)          
     ENDIF                                       
     ENDIF                                       
     IF        F1@FC = 'P'                       
     CALLP     DN@DBBLOEC1(E@DBFINDGE)           
     CALLP     DN@DBBLOEC1(E@DBFINDPRV)