Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Deleting records from a file

To remove an existing record from an indexed or relative file, open the file I-O and use the DELETE statement. You cannot use DELETE for a sequential or line-sequential file.

When ACCESS IS SEQUENTIAL, the record to be deleted must first be read by the COBOL program. The DELETE statement removes the record that was just read. If the DELETE statement is not preceded by a successful READ, the record is not deleted, and the file status key value is set to 92.

When ACCESS IS RANDOM or ACCESS IS DYNAMIC, the record to be deleted need not be read by the COBOL program. To delete a record, move the key of the record to the RECORD KEY data item, and then issue the DELETE.

Check the file status key after each DELETE statement.

related concepts
File organization and access mode

related tasks
Opening a file
Reading records from a file
Using file status keys

related references
FILE STATUS clause (COBOL for Windows Language Reference)


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)