COBOL/400 Language Help


DELETE Statement

Description
The DELETE statement removes a record from an indexed or relative file. For indexed files, you may reuse the key for record addition. For relative files, the space is then available for a new record with the same RELATIVE KEY value.

When the DELETE statement is executed, the associated file must be open in I-O mode.

After successful execution of a DELETE statement, the record is logically removed from the file and can no longer be accessed. Execution of the DELETE statement does not affect the contents of the record area associated with the file-name.

If you specified the FILE STATUS clause in the File-Control entry, the associated status key is updated when the DELETE statement is executed.

The file position indicator is not affected by the processing of the DELETE statement.

->->---DELETE file-name----*--------*------------------------->
                         *-RECORD-*
 
->---*--------------------------------*---------------------->
    *-FORMAT-*----*-*-identifier-1-*-*
             *-IS-* *-literal-1----*
 
->---*-------------------------------------------------*----->
    *-INVALID---*-----*---imperative-statement-1------*
                *-KEY-*
 
->---*-------------------------------------------------*----->
    *-NOT INVALID---*-----*---imperative-statement-2--*
                    *-KEY-*
 
->---*------------*------------------------------------------><-
    *-END-DELETE-*
 


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