850-FIND-MIDSUBRNG-<Index>

Name

850-FIND-MIDSUBRNG-<Index>

Description

When you need to process a range of data, starting at a given point in a subrange, use 850-FIND-MIDSUBRNG-<Index> .

Using the API in a Program

You can use 850-FIND-MIDSUBRNG-<Index> in conjunction with 850-FIND-SUBRNG-<Index> and 860-FIND-NXTRNG-<Index> .

The database routines perform an equal condition on all DB index fields up to the subrange field designated in the WS-DB-SUB-RNG . It performs a "where greater-than and less-than" condition on this index field.

Input Values

Field Description

<Index>

You must specify the index in the FIND statement.

Record retrieval variables (also known as DB fields) Fill in the DB fields that define the point to position at in the mid-subrange, and also initialize any other DB fields that do not define the mid-subrange.
DBSRNG-<KeyFieldName> Define the beginning value of the last key by moving the appropriate values to the record retrieval field named DBSRNG-<KeyFieldName> (starting value).
DBRNG-<KeyFieldName> Define the ending values of the last key by moving the appropriate values to the record retrieval field named DBRNG-<KeyFieldName> (ending value).
WS-DB-SUB-RNG

Move the symbolic constant <IndexName>-<IndexFieldName> to the field WS-DB-SUB-RNG in order to tell the interface which key is the last significant one defining the range. The symbolic constant is numerically equivalent to the position of the named field in the Index.

Return Values

Field Description
<FileName>-SW The Find routines set the <FileName>-SW switch to indicate the outcome of the read.

<FileName>-NOTFOUND

<FileName>-FOUND

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

Programming Example

* Set up initial SUBRNG for a range of INVOICES whose values 
* are in WS-SUB-BEG and * WS-SUB-END

MOVE SMIDF1-SV-ARH-TRANS-TYPE  TO DB-ALT-TYPE
MOVE SMIDF1-SV-ARH-COMPANY     TO DB-COMPANY
MOVE WS-SUB-BEG                TO DB-INVOICE
MOVE WS-SUB-END                TO DBRNG-INVOICE
MOVE ARHSET6-INVOICE           TO WS-DB-SUB-RNG
PERFORM 850-FIND-SUBRNG-ARHSET6

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

IF (SMIDF1-FC = "+")
MOVE SMIDF1-PT-ARH-TRANS-TYPE  TO DB-ALT-TYPE
MOVE SMIDF1-PT-ARH-COMPANY     TO DB-COMPANY
MOVE SMIDF1-PT-ARH-INVOICE     TO DB-INVOICE
MOVE ARHSET6-INVOICE           TO WS-DB-SUB-RNG
MOVE WS-SUB-BEG                TO DBSRNG-INVOICE
MOVE WS-SUB-END                TO DBRNG-INVOICE
PERFORM 850-FIND-MIDSUBRNG-ARHSET6