Monday, September 26, 2011

Utilities: Delete member of a PDS using JCL

Problem
Is it possible using JCL, to delete a member of a PDS, when other users are making use of the dataset ?

That is, without getting EXCLUSIVE ownership of the dataset, is it possible to delete a member from the dataset ?

The following code does not work, since IDCAMS requires exclusive access on the PDS :

//IDCAMS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=* 
//SYSIN DD *
DELETE 'YOUR.PDS(MEMBER)'
/*


Solution
Here is how it could be done :

//IDCAMS   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//DD1   DD DISP=SHR,DSN=YOUR.PDS
DELETE 'YOUR.PDS(MEMBER)' FILE(DD1)
/*

Note that it is NOT the DISP parameter which helps to delete the member. The option FILE is the one which deletes the member.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.