Posted: Mon Aug 11, 2008 8:19 am Post subject: Delete Members in a dataset
Hi,
We have a common dataset, lets say DATASET.TEST.MEMBERS. We used to process some members and manually delete it. Then it was automated using a code which automatically deletes it if processed successfully. When I saw the dymamic code it was like this
//DEL0001 EXEC PGM=IDCAMS,COND=(5,LE)
//SYSPRINT DD SYSOUT=*
DELETE DATASET.TEST.MEMBERS(MEM1)
IF MAXCC EQ 8 THEN SET MAXCC = 0
/*
Problem here is, if any one is present inside this dataset, the member is not getting deleted when the code runs.
Can we have a solution in IDCAMS, where the members can be deleted even if the dataset is accessed by anyother user? _________________ Arvind
"You can make a difference with your smile. Have that with you always"
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Mon Aug 11, 2008 9:26 am Post subject:
I think IDCAMS DELETE allocates datasets DISP=OLD; at least it does when invoked as a TSO command.
You could use ISPF services LMINIT, LMOPEN, LMMDEL, LMFREE in a Rexx exec that you run in batch. LIMINIT with the ENQ(SHRW) operand will let you do this while others have the data set open in ISPF, unless, of course, they are editing a member you are trying to delete.
Remember that to run ISPF services in batch, your JCL needs the ISPF libraries allocated to it. Look at BATCHPDF for an example of how to set this up at your site (use your favorite search engine to find it). _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum