Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.9 DELETE Statement

The DELETE statement removes a record from an indexed or relative file. For indexed files, the key can then be reused 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.

    ___ Format _____________________________________________________________ 
   |                                                                        |
   | >>__DELETE__file-name-1__ ________ __________________________________> |
   |                          |_RECORD_|                                    |
   |                                                                        |
   | >__ __________________________________________ ______________________> |
   |    |_INVALID__ _____ __imperative-statement-1_|                        |
   |               |_KEY_|                                                  |
   |                                                                        |
   | >__ ______________________________________________ __________________> |
   |    |_NOT INVALID__ _____ __imperative-statement-2_|                    |
   |                   |_KEY_|                                              |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DELETE_|                                                      |
   |                                                                        |
Must be defined in an FD entry in the Data Division and must be the name of an indexed or relative file.

After successful execution of a DELETE statement, the record is removed from the file and can no longer be accessed.

>_OS/2_> For OS/2 VSAM files, after the successful execution of a DELETE statement, any record lock held by the file connector on the deleted record is released. However, if any other file connector holds a lock on the record to be deleted, the DELETE statement is unsuccessful. <_OS/2_<

Execution of the DELETE statement does not affect the contents of the record area associated with file-name-1 or the content of the data item referenced by the data-name specified in the DEPENDING ON phrase of the RECORD clause associated with file-name-1.

If the FILE STATUS clause is specified 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 execution of the DELETE statement.


Previous Topic Next Topic Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.

Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS

Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.