ILE COBOL Language Reference

Random or Dynamic Access Mode

In random and dynamic access modes, the results of using the DELETE statement depend on the file organization.

When it is a relative file, the system logically removes the record identified by the contents of the RELATIVE KEY data item. The space is then available for a new record with the same RELATIVE KEY value. If the file does not contain such a record, an INVALID KEY condition exists.

On an indexed file, the system logically removes the record identified by the contents of the RECORD KEY data item. If the file does not contain such a record, an INVALID KEY condition exists.

+-------------------------------IBM Extension--------------------------------+

When EXTERNALLY-DESCRIBED-KEY is specified for the file, the key fields in the record area for the format specified by the FORMAT phrase are used to find the record to be deleted. If the FORMAT phrase is not specified, the first format defined in the program for the file is used to find the record to be deleted.

+----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

Duplicates Phrase

If this phrase was specified for the file, the last input/output statement processed for this file before the processing of the DELETE statement must have been a successfully processed READ statement without the NO LOCK phrase.

The record read by that statement is the record that is deleted.

In this case, the FORMAT phrase is not used to find the record to be deleted. The READ statement is required to ensure that the proper record is deleted when there are duplicates.

If a successful READ operation did not occur before the delete operation:

If the last input/output statement was a successfully processed READ statement with the NO LOCK phrase:

If the value of the RECORD KEY data item has been changed since the record was read:

+----------------------------End of IBM Extension----------------------------+


Footnotes:

2
The key fields in the record area are the locations in the buffer selected in accordance with a record format or specification in order to build a search argument.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]