Why ESDS record can't be deleted physically?

All sort of Mainframes Interview Questions.
Post Reply
User avatar
AD991
Registered Member
Posts: 92
Joined: Wed May 08, 2013 7:36 pm

Why ESDS record can't be deleted physically?

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
User avatar
AD991
Registered Member
Posts: 92
Joined: Wed May 08, 2013 7:36 pm

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

Post 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?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

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

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
User avatar
AD991
Registered Member
Posts: 92
Joined: Wed May 08, 2013 7:36 pm

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”