E@DBFINDMIDSUB

Name

The E@DBFINDMIDSUB call has the following format:

DN@<Logical>(E@DBFINDMIDSUB)

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

Description

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

Using the API in a Program

You can use E@DBFINDMIDSUB in conjunction with E@DBFINDSUBRNG and E@DBFINDNXTRNG.

The database routines perform an equal condition on all D@ index fields up to the subrange field designated in the E@DBSUBRNG. It performs a "where greater-than and less-than" condition on this index field.

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@ and D# fields) Fill in the D@ fields that define the point to position at in the mid-subrange, and also initialize any other D@ fields that do not define the mid-subrange.
D#START#<KeyFieldName> Define the beginning value of the last key by moving the appropriate values to the record retrieval field named D#START#<KeyFieldName> (starting value).
D#END#<KeyFieldName> Define the ending values of the last key by moving the appropriate values to the record retrieval field named D#END#<KeyFieldName> (ending value).
E@DBSUBRNG Move a number into E@DBSUBRNG 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 Example

* Set up initial SUBRNG for a range of INVOICES whose values
* are in D@INVC and * D#END#INV

       EVAL      D@ALTTYP       = F1@SVARHT
       EVAL      D@CMPNY        = F1@SVARHC
       EVAL      D#START#INV    = F1@INVCFR
       EVAL      D#END#INV      = F1@INVCT
       EVAL      E@DBSUBRNG     = 3
       CALLP     DS@DBARARH6(E@DBFINDSUBRNG)

* Set up MIDSUB from the initial SUBRNG for screen scrolling,
* starting at the next * invoice from the displayed group on
* the screen

       IF        F1@FC = '+'
       EVAL      D@ALTTYP       = F1PTARHT
       EVAL      D@CMPNY        = F1@PTARHC
       EVAL      D@INVC         = F1@PTARHI
       EVAL      E@DBSUBRNG     = 3
       EVAL      D#START#INV    = F1@INVCFR
       EVAL      D#END#INV      = F1@INVCT
       CALLP     DS@DBARARH6(E@DBFINDMIDSUB)