E@DBFINDMIDRNG

Name

The E@DBFINDMIDRNG call has the following format:

DN@<Logical>(E@DBFINDMIDRNG)

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

Description

When you need to process a range of data, starting at a given point in the range, use E@DBFINDMIDRNG.

Using the API in a Program

You can use this routine by itself or in conjunction with E@DBFINDBEGRNG and E@DBFINDNXTRNG.

The database routines perform an equal condition on all D@ fields that have an assigned value—that is, all columns up to, and including, the field moved to E@DBBEGRNG.

Input Values

Field Description
<Logical> <Logical> in the E@ statement identifies the database file and index to use to perform the call.
Record retrieval variables (also known as D@ fields) Define the beginning and ending values of the last key by moving the appropriate values to the record retrieval fields named D@<KeyFieldName>.
E@DBBEGRNG Move a number into E@DBBEGRNG in order to tell the interface which key is the last significant one defining the range. This number is equivalent to the position of the field in the index.

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 Examples

This example uses the 850-FIND-BEGRNG-NAMSET1 routine to locate records with the last name of Smith, then uses the 850-FIND-MIDRNG-NAMSET1 routine to find records with the last name of Smith and first name of Pam.

       EVAL      D@LSTNM        = 'Smith'  
       EVAL      E@DBBEGRNG     = 2                 
       CALLP     DN@DBHRNAMVEN1(E@DBFINDBEGRNG)          
*later...
       EVAL      D@LSTNM        = 'Smith'          
       EVAL      D@FSTNM        = 'Pam'       
       CALLP     DS@DBHRNAM1(E@DBFINDMIDRNG)

The next example uses the E@DBFINDMIDRNG routine by itself to go directly to record with E@DBBEGRNG, and process from that record forward.

       EVAL      D@LSTNM        = 'Smith' 
       EVAL      E@DBBEGRNG     = 2                 
       EVAL      D@FSTNM        = 'Pam'
       CALLP     DN@DBHRNAM1(E@DBFINDMIDRNG)

This final example sets the initial range value on D@ALTTYP field using the E@DBFINDBEGRNG routine, and then sets the mid-range values from the initial E@DBFINDBEGRNG results. Processing with the E@DBFINDMIDRNG routine starts at the next INVOICE value.

       EVAL      D@ALTTYP       = F1@SVARTY  
       EVAL      D@CMPNY        = F1@SVARHC
       EVAL      E@DBBEGRNG     = 2                 
       CALLP     DN@DBARARH6(E@DBFINDBEGRNG)
* Set up MIDRNG from the initial BEGRNG for screen scrolling,
* start at next INVOICE
       EVAL      D@ALTTYP       = F1@PTARHT
       EVAL      D@CMPNY        = F1@PTARHC
       EVAL      D@INVC         = F1@PTARHI
       EVAL      E@DBBEGRNG     = 3
       CALLP     DN@DBARARH6(E@DBFINDMIDRNG)