Page 1 of 3

Empty out the Dataset

PostPosted: Tue Dec 14, 2010 5:54 am
by fornanthakumar
Hi,

I want to delete records from datasets. (ie) To empty out the dataset.

Is it possible through REXX.

Re: Empty out the Dataset

PostPosted: Tue Dec 14, 2010 7:39 am
by MrSpock
The only way I know of is to open the dataset, push a single empty string, and then write the one record and close the file:

/* REXX */
"EXECIO 0 DISKR i"
Push ""
"EXECIO 1 DISKW i (FINIS"
Exit 0

Re: Empty out the Dataset

PostPosted: Tue Dec 14, 2010 10:38 am
by NicC
Or have your exec open the dataset in edit, delete all the records and then close.

Re: Empty out the Dataset

PostPosted: Wed Dec 15, 2010 10:57 am
by steve-myers
MrSpock and NicC describe "emptying" a sequential data set. You have to use other methods to "empty" other types of data sets. The method discussed by MrSpock is probably the safest technique, but that's just my personal opinion.

Re: Empty out the Dataset

PostPosted: Thu Dec 16, 2010 1:40 am
by dick scherrer
Hello,

Why does someone believe these datasets need to be "empty"?

Re: Empty out the Dataset

PostPosted: Fri Dec 17, 2010 2:30 am
by MFSlearner
The below Rexx code also deletes all the records from a dataset:

address tso
"alloc dd(infile) da('userid.SUPERC.LIST') shr reuse"
"execio 0 diskw infile (open finis"
"free dd(infile)"

Re: Empty out the Dataset

PostPosted: Fri Dec 17, 2010 2:54 am
by dick scherrer
Hello,

The below Rexx code also deletes all the records from a dataset
Well, from some of them anyway. . .

Re: Empty out the Dataset

PostPosted: Sat Dec 18, 2010 10:49 pm
by Pedro
Or have your exec open the dataset in edit, delete all the records and then close.

It will work but, compared to just using simple I/O instructions, will use tremendous overhead (need ISPF environment, reading all the records, managing virtual storage, etc...). You should try both and measure the system resources used in each case.

Re: Empty out the Dataset

PostPosted: Sun Dec 19, 2010 1:08 am
by NicC
The only way I know of is to open the dataset, push a single empty string, and then write the one record and close the file:


But that does not empty the file - it still leaves the line that you PUSHed and wrote. (I just got round to trying it)

Re: Empty out the Dataset

PostPosted: Sun Dec 19, 2010 5:27 am
by steve-myers
It seems to me fornanthakumar wants a data security erase program. There are two possibilities: one that is good enough, the other meets United States Department of Defense requirements.

The solutions that have been proposed here effectively remove the records from the first track and most likely the second track. None of the remaining tracks will be touched, though it will be difficult for most of us to get to them. These solutions represent what can be reliably accomplished using Rexx.

I'm not sure it is possible to meet Department of Defense requirements with modern RAID based DASD, though a good enough solution will work fine. It's just a guess, but I think you'd have to remove every commodity hard drive in the RAID array, plug them into PC that can handle them, and then run a program tailored to the hard drive that will erase the hard drive to Department of Defense requirements. This, of course will erase the entire RAID.