820-STORE-<FileName>

Name

820-STORE-<FileName>

Description

820-STORE-<FileName> either adds or updates the current record in the file record area. The choice depends on how you define the record in that area.

If you use either 800-CREATE-<FileName> or 810-RECREATE-<FileName> , the subsequent 820-STORE-<FileName> routine adds a new record to the appropriate file and its indexes. You define new key field values in the file record area before performing 820-STORE-<FileName> .

If you perform a modify routine to read the current database record, the subsequent 820-STORE-<FileName> routine updates the appropriate file with the current record area contents. The 820-STORE-<FileName> routine also updates all changed index entries for the changed record.

Using the API in a Program

  • Use the 910-AUDIT-BEGIN routine to open a transaction state.

  • Make a new blank record in the database using the 800-CREATE-<FileName> routine.

  • Use MOVE statements to populate the fields for this new record. If a MOVE statements is left out, the field it populates remains filled with zeros or spaces. The values placed in the record area determine the key field for the record.

  • 820-STORE-<FileName> does not use the record retrieval variables (DB fields) to access a particular record. Instead, you must set valid values in the record area associated with the file before performing 820-STORE-<FileName> .

  • The 820-STORE-<FileName> call adds the new record to the SALESREP file.

  • 920-AUDIT-END closes the transaction state, committing the transaction to the database.

Input Values

Field Description

<Index>

You must specify the index in the FIND statement.

Programming Example

***     Add a new record to the SALESREP file.
        PERFORM 910-AUDIT-BEGIN.

        PERFORM 800-CREATE-SALESREP.
        MOVE WS-COMPANY              TO SAW-COMPANY.
        MOVE WS-SALESMAN             TO SAW-SALESMAN.
        MOVE WS-NAME                 TO SAW-NAME.
        MOVE WS-TERRITORY            TO SAW-TERRITORY.
        MOVE WS-COMM-RATE            TO SAW-COMM-RATE.
        MOVE WS-USED-FL              TO SAW-USED-FL.
        MOVE WS-ACTIVE-STATUS        TO SAW-ACTIVE-STATUS.
        PERFORM 820-STORE-SALESREP.

        PERFORM 920-AUDIT-END.