Page 1 of 1

Deleting records from ESDS data set.

Posted: Sun Sep 20, 2015 1:54 pm
by Mamta LDH
I was asked if we can delete a record from ESDS?

I said , No, we cannot delete a record from ESDS. To this interviewer said, have you ever tried it?

I replied no. I never needed such a logic in my programs. But I have read about this that we can not delete a record from ESDS data sets. "That's in theory. I have deleted a record from ESDS many times" , interviewer said.

I still think that we can not physically delete the records from ESDS but I might be wrong. Can anyone please help me on this.

Re: Deleting records from ESDS data set.

Posted: Sun Sep 20, 2015 2:10 pm
by zprogrammer
You cannot delete records from ESDS file

If you need records not to be present in output eliminate them through SORT

Suggest you to read through VSAM DEMYSTIFIED

Re: Deleting records from ESDS data set.

Posted: Sun Sep 20, 2015 2:27 pm
by William Collins
The ES, Entry Sequenced, in ESDS is the give-away. No, you cannot delete a record from an ESDS. Absolutely cast iron, rock solid. Anyone who tells you otherwise is an idiot. A record on an ESDS can be accessed by its RBA (Relative Byte Address). That would not work if the RBA was subject to change through record-deletion. The only way it could be done would be to "shuffle along" the subsequent records in the file. Fortunately, that was an original design choice easily avoided.

To remove records from an ESDS, you need something which will read a copy of the original and write to the original ESDS (ensuring that the data is not "tacked on at the end" through one of various means).