To delete records, use the library function
fdelrec(), a
z/OS® XL C/C++ extension
to the SAA C library. For more information on this function,
see
z/OS XL C/C++ Runtime Library Reference.
- KSDS, KSDS PATH, and RRDS
To delete records,
you must perform the following operations:
- Open the VSAM file in update mode (rb+/r+b, ab+/a+b,
or wb+/w+b specified as the required positional parameter
of the fopen() function call and type=record).
- If the file is not already positioned at the record you want to
delete, reposition to that record.
- Read the record using the fread() function.
Once the record
you want to delete has been read in, you must ensure that no reading,
writing, or repositioning operations are performed before fdelrec().
- Delete the record using the fdelrec() function.
Note: If the data set was opened with an access
mode of rb+ or r+b, a read operation can result
in the locking of control intervals, depending on shareoptions specification
of the VSAM file. If after reading a record, you decide not to delete
it, you may need to unlock a control interval by performing a file-positioning
operation to the same record, such as an flocate() using the same
key.
- ESDS and ESDS PATH
VSAM does not support
deletion of records in ESDS files.