Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You can't delete a record from KSDS with SORT.
You can read an entire dataset and write out all but the record you don't want, but there will be more efficient ways than that, if you have been clear in what you want.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
If your VSAM data set defined with REUSE, then you can use VSAMIO parm so that you can use the same VSAM data set for input and output. However there are some conditions to be met. Please read upon the parm VSAMIO in the following link for a detailed explanation of the parm.
Magesh: A little Google search could give you many answers on what you have asked, here is one of the similar solution I could find ;
We first copy contents of the vsam file to a temp dataset. Now we concatenate this temp dataset along with the records to be deleted and load back to the original file.when we concate the records to be deleted file with the temp dataset, all the keys which we want to delete will be duplicates. So we use the SELECT operator with NODUPS option to eliminate all the records to be deleted. Note that the out vsam dataset is same as the input dataset. You can use the same input vsam file as output vsam file when it is defined with REUSE option
Thanks Rohit and Kolsu, this is really awesome and useful, I actually did this in another way ,which was very lengthy process, But applicable for all VSAM
since i dont know how to find whether it is in re-use or not and in defintion of the control card it doesnt have reuse keyword