830-FULL-DELETESUBRNG-<Index>

Name

830-FULL-DELETESUBRNG-<Index>

Description

830-FULL-DELETESUBRNG-<Index> deletes all records in a subrange.

When this routine deletes a subrange of database records, it also deletes all index entries associated with that subrange of records and all related records according to the delete rules as set in the database file definition.

Delete Rule Description
Delete Ignored No deletion of related records.
Delete Restrict Related records must be deleted or moved first by the application.
Delete Cascades Delete all records in the related table described by the relation.

For more information on data deletion rules, see the Application Development Workbench guide.

Using the API in a Program

You specify the range similarly to the 830-FULL-DELETERNG-<Index> call, but with the addition of another DB field named DBRNG-<IndexFieldName>, which is used to specify the end value of the last field in the subrange.

You must populate the delimiting DB fields, the DBRNG field, and WS-DB-SUB-RNG before using 830-FULL-DELETESUBRNG-<Index> .

Note: In recoverable database environments, 830-FULL-DELETESUBRNG-<Index> cannot span more than one transaction state. Deleting a very large subrange of records in a single block creates a very large journal, or transaction, that may exceed a limit. If a subrange does not realistically fit in a single transaction, you must use a modify/delete loop, with specific attention paid to controlling the size of the logical transactions.

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.

DBSRNG-<KeyFieldName>

DBRNG-<KeyFieldName>

Define the beginning and ending values of the last key by moving the appropriate values to the record retrieval fields named DBSRNG-<KeyFieldName> (starting value) and DBRNG-<KeyFieldName> (ending value). This defines the range itself.
WS-DB-SUB-RNG

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

Programming Example

The following example shows the 830-FULL-DELETESUBRNG-<Index> routine used to drop a subrange of records from the a file.

*       Delete all sales reps from a subrange of  
*       companies in the SALESREP file.
        PERFORM 910-AUDIT-BEGIN.

        MOVE WS-FROM-COMPANY        TO DB-COMPANY.
        MOVE WS-THRU-COMPANY        TO DBRNG-COMPANY.
        MOVE SAWSET1-COMPANY        TO WS-DB-SUB-RNG.
        PERFORM 830-FULL-DELETESUBRNG-SAWSET1.

        PERFORM 920-AUDIT-END.