Page 1 of 1

Why ESDS record can't be deleted physically?

Posted: Mon Nov 04, 2013 5:14 pm
by AD991
Hi,

I was asked that why ESDS record can't be deleted physically? Unfortunately, I did not know the answer - can someone please help?

Re: Why ESDS record can't be deleted physically?

Posted: Mon Nov 04, 2013 5:37 pm
by Robert Sample
From the VSAM Demystified Redbook (SG24-6105):
Entry-sequenced data set
You specify entry-sequenced data set (ESDS) organization by using the IDCAMS DEFINE
command and specifying the NONINDEXED parameter.
An ESDS is comparable to a sequential non-VSAM data set in the sense that records are
sequenced by the order of their entry in the data set, rather than by key field in the logical
record, which could be fixed or variable length records.
All new records are placed at the end of the data set. There is no split concept. Existing
records can never be physically deleted, or as far as VSAM is concerned, the record is not
scratched. It is the responsibility of the application program to identify that record as invalid
through an application identified flag.
The content of records can be updated, but their length cannot be changed. To change the
size of a record, use one of these techniques:
Store it at the end of the data set as a new record
Override an existing record of the same length that you have flagged as inactive
Deleting a record requires removing the data from the disk. Once VSAM has written something to disk, you can overlay that area with other data, but there will be something in that area of the VSAM file. To completely remove the data, you would have to read in the VSAM file, copy all the records (except the ones you want to delete) to another file, delete / define the VSAM file, then copy the records back into the VSAM file.

Re: Why ESDS record can't be deleted physically?

Posted: Mon Nov 04, 2013 7:38 pm
by AD991
Thanks Robert. But this
Deleting a record requires removing the data from the disk.
should also be applicable to KSDS but that allows deleting the record; then why it is applied only to ESDS?

Re: Why ESDS record can't be deleted physically?

Posted: Tue Nov 05, 2013 4:08 am
by William Collins
An ESDS just does not support a physical delete. Or an insertion within existing data. It is how it is designed. End of story.

For a KSDS, records can be inserted in key order, and deleted. It is how it is designed. End of story.

The KSDS has more processing and control-records, which in the normal course of events you don't need to know about. If you want to find out more about the file structure of a KSDS, have a look at the VSAM Demystified publication.

Re: Why ESDS record can't be deleted physically?

Posted: Wed Nov 06, 2013 9:09 pm
by Robert Sample
KSDS is based upon the key while ESDS is based upon the entire record. You can delete keys in a KSDS, and VSAM may (or may not depending upon the IDCAMS DEFINE statement) reuse the space for another record. However, ESDS records once written are permanent (at least until the data set is deleted and redefined). Why this is the case doesn't really matter -- what matters is that you know the difference.

Re: Why ESDS record can't be deleted physically?

Posted: Mon Dec 02, 2013 2:54 pm
by AD991
Thanks William and Robert.

Sometimes interviewers ask "stupid questions" and you need to explain about this as much as you can, that's why I asked this question.