850-FIND-MIDRNG-<Index>

Name

850-FIND-MIDRNG-<Index>

Description

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

Using the API in a Program

You can use this routine by itself or in conjunction with 850-FIND-BEGRNG-<Index> and 860-FIND-NXTRNG-<Index> .

The database routines perform an equal condition on all DB fields that have an assigned value--that is, all columns up to, and including, the field moved to WS-DB-BEG-RNG .

Input Values

Field Description

<Index>

You must specify the index in the FIND statement.

Record retrieval variables (also known as DB fields) Define the beginning and ending values of the last key by moving the appropriate values to the record retrieval fields named DB- <KeyFieldName>.
WS-DB-BEG-RNG

Move the symbolic constant <IndexName>-<IndexFieldName> to the field WS-DB-BEG-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 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.

MOVE "Smith"                    TO DB-LASTNAME
MOVE NAMSET1-LASTNAME          TO WS-DB-BEG-RNG
PERFORM 850-FIND-BEGRNG-NAMSET1.
*later...
MOVE "Smith"                    TO DB-LASTNAME
MOVE "Pam"                      TO DB-FIRSTNAME
PERFORM 850-FIND-MIDRNG-NAMSET1.

The next example uses the 850-FIND-MIDRNG routine by itself to go directly to record with WS-DB-BEG-RNG , and process from that record forward.

* Uses 850-FIND-MIDRNG by itself to go directly to record 
* within BEGRNG and process from that record forward.
MOVE "Smith"                    TO DB-LASTNAME
MOVE NAMSET1-LASTNAME           TO WS-DB-BEG-RNG
MOVE "Pam"                      TO DB-FIRSTNAME
PERFORM 850-FIND-MIDRNG-NAMSET1.

This final example sets the initial range value on ALT-TYPE field using the 850-FIND-BEGRNG routine, and then sets the mid-range values from the initial 850-FIND-BEGRNG results. Processing with the 850-FIND-MIDRNG routine starts at the next INVOICE value.

* Set up the initial BEGRNG on ALT-TYPE
MOVE SMIDF1-SV-ARH-TRANS-TYPE   TO DB-ALT-TYPE
MOVE SMIDF1-SV-ARH-COMPANY      TO DB-COMPANY
MOVE ARHSET6-ALT-TYPE           TO WS-DB-BEG-RNG
PERFORM 850-FIND-BEGRNG-ARHSET6
* Set up MIDRNG from the initial BEGRNG for screen scrolling,
* start at next INVOICE
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-BEG-RNG
PERFORM 850-FIND-MIDRNG-ARHSET6