860-MODIFY-NXTRNG-<Index>

Name

860-MODIFY-NXTRNG-<Index>

Description

When you need to update a range of data without interruption, 860-MODIFY-NXTRNG-<Index> retrieves the next database record in a range and prepares it for updating by an 820-STORE-<FileName> call.

Using the API in a Program

You must precede 860-MODIFY-NXTRNG-<Index> with 850-MODIFY-BEGRNG-<Index> , 850-MODIFY-SUBRNG-<Index> , 850-MODIFY-SUBRNG-<Index> , or 850-MODIFY-MIDSUBRNG-<Index> .

Input Values

Field Description

<Index>

You must specify the database index name that you want to create a record in.
Record retrieval variables (also known as DB fields)

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

Fill in only the DB fields that define the appropriate range; leave empty those DB fields that do not define the range.

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 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 how to update a series of records in a file.

*       Update a range 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 SAWSET1-COMPANY             TO WS-DB-BEG-RNG.
        PERFORM 850-MODIFY-NXTRNG-SAWSET1.
        PERFORM
            UNTIL (SALESREP-NOTFOUND)
            MOVE WS-NEW-COMM-RATE        TO SAW-COMM-RATE
            PERFORM 820-STORE-SALESREP
            PERFORM 860-MODIFY-NXTRNG-SAWSET1
        END PERFORM.

        PERFORM 920-AUDIT-END.

Comparing this example to the routine that uses 850-MODIFY-NLT-<Index> and 860-MODIFY-NEXT-<Index> shows two major usage differences:

  • You do not have to fill the extra index key with blanks. Instead, the WS-DB-BEG-RNG variable identifies the last key to be used as a delimiter.

  • You no longer need to use the extra OR check on the DB- field in the UNTIL clause. The interface performs the check.

You can also use a 850-FIND-BEGRNG-<Index> , 850-FIND-SUBRNG-<Index> and 860-FIND-NXTRNG-<Index> loop for updates with an 840-MODIFY-<Index> . If your use the find loop versus a modify loop, the 840-MODIFY-<Index> must be a different index than that used on the FIND loop.