850-MODIFY-NLT-<Index>

Name

850-MODIFY-NLT-<Index>

Description

850-MODIFY-NLT-<Index> reads the record whose key field is greater than or equal to the values you set in the record retrieval variables (DB fields) corresponding to the index key fields. This routine also readies the record for updating by 820-STORE-<FileName> .

Using the API in a Program

850-MODIFY-NLT-<Index> must be paired with 860-MODIFY-NEXT-<Index> or 870-MODIFY-PREV-<Index>

850-MODIFY-NLT-<Index> does not need to point to an existing record (unlike the 840-MODIFY-<Index> routine). If you define a generic value for the record search, the routine returns a record and a <FileName>-FOUND for any database record successfully read.

Input Values

Field Description

<Index>

You must specify the database index name that you want to create a record in.

Note: If a key field in the index definition is declared as descending, populate that key field with a maximum value rather than a minimum value.
Record retrieval variables (also known as DB fields)

You must populate the index key fields used to locate the record before using this call.

You do not need to fill all DB fields with actual values, because the routine does not need to point to an existing record. Instead, you fill those fields that are not required as delimiters with zeros or spaces, depending on whether the fields are numeric or alphanumeric fields. If you need to know whether the record exactly matches the key fields you passed, you must check that the record matches the generic values you set.

Return Values

Field Description

<FileName>-SW

The Modify routines set the <FileName>-SW switch to indicate the outcome of the read. This routine sets the logical value <FileName>-NOTFOUND or <FileName>-FOUND based on the outcome of the read process.

Programming Example

The following example shows the use of the modify calls to update a series of records in a file.

*   Update a series of SALESREP records for all sales reps 
*   in a company to reflect a new commission rate.
*
       PERFORM 910-AUDIT-BEGIN.
                  
       MOVE WS-COMPANY        TO DB-COMPANY.
       MOVE ZEROS             TO DB-SALESMAN.
       PERFORM 850-MODIFYNLT-SAWSET1.
       PERFORM
           UNTIL     (SALESREP-NOTFOUND)
           OR        (SAW-COMPANY       NOT = DB-COMPANY)
           MOVE WS-NEW-COMM-RATE        TO SAW-COMM-RATE
           PERFORM 820-STORE-SALESREP
           PERFORM 860-MODIFY-NEXT-SAWSET1
       END PERFORM.

       PERFORM 920-AUDIT-END.