Saturday, December 17, 2011

Deleting Records from a VSAM File


   Open the file for I-O and use the DELETE statement to remove an existing
   record on an indexed or relative file.  You cannot use DELETE on a
   sequential file.

   When ACCESS IS SEQUENTIAL, or if the file contains spanned records, the
   record to be deleted must first be read by the COBOL program.  The DELETE
   then removes the record that was read.  If the DELETE is not preceded by a
   successful READ, the deletion is not done and the status key value is set
   to 92.

   When ACCESS IS RANDOM or ACCESS IS DYNAMIC, and if the records are not
   spanned, the record to be deleted need not be read by the COBOL program.
   To delete a record, the key of the record to be deleted is moved to the
   RECORD KEY data item and the DELETE is issued.  You should check the file
   status key after each DELETE statement. 

No comments:

Post a Comment