860-FIND-NEXT-<Index>

Name

860-FIND-NEXT-<Index>

Description

Once you have defined a position in the file with a successful 850-FIND-NLT-<Index> , use the 860-FIND-NEXT-<Index> routine to process database records sequentially in Index order. This routine reads the record following the current record for this index.

Using the API in a Program

850-FIND-NLT-<Index> must precede a 860-FIND-NEXT-<Index> .

Input Values

Field Description

<Index>

You must specify the index in the FIND statement.

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

This example processes a set of records for a particular subaccount from a specific company account. The first three lines show the key fields being set for the appropriate company, account, and subaccount combination. The index has two other key fields in it, so lines four and five fill those fields with blank values, because they are not going to be used as delimiters.

Once all the index key fields have been populated, the 850-FIND-NLT-GLMSET1 routine uses the specified index to get the first record defined by the key fields. Four conditions are then defined to see if the retrieved record fits the desired set. If so, the record is processed, and 860-FIND-NEXT-GLMSET1 retrieves the next record for checking and processing. Processing continues until 860-FIND-NEXT-<Index> routine returns a value that violates one of the four checking conditions.

***  Process a set of records using FIND-NLT and FIND-NEXT
     MOVE WS-COMPANY                TO DB-COMPANY.
     MOVE WS-ACCOUNT                TO DB-ACCOUNT.
     MOVE WS-SUB-ACCOUNT            TO DB-SUB-ACCOUNT.
     MOVE ZEROS                     TO DB-VAR-LEVELS.
     MOVE SPACES                    TO DB-ACCT-UNIT.
     PERFORM 850-FIND-NLT-GLMSET1.
     PERFORM
         UNTIL     (GLMASTER-NOTFOUND)
         OR        (GLM-COMPANY        NOT = DB-COMPANY)
         OR        (GLM-ACCOUNT        NOT = DB-ACCOUNT)
         OR        (GLM-SUB-ACCOUNT    NOT = DB-SUB-ACCOUNT)
                   PERFORM 999-PROCESS-GLM      
                   PERFORM 860-FIND-NEXT-GLMSET1
     END-PERFORM.