using iefbr14 if your dataset does not exist the job will fail (JCL ERROR)
as dataset is 'linked' via DD statement, if you use DISP=(old,delete).
BUT if you use :
(note disp is mod delete and lrecl and blksize can be anything u choose as dataset won't be used in that step.)
if dataset does not exist it is created and deleted in same JCL allocation CARD
if it exists it is EXPANDED (MOD) and deleted in same JCL allocation CARD
u can the allocate it as u wish.
and if somebody uses dataset your job is in contention for the dataset with that somebody (be it user or job)
___________________________________________________
using IDCAMS needs not be DD coded (it can be ) so job should end with a RC of 8 (trappable)
I think that is another user is using the dataset you are trying to delete it will end up with a rc.
I'd rather use IEFBR14 as aforementionned so my job hangs on to the dataset I'm using where as IDCAMS step may execute and subsequent execution would carry on.
maybe you should change allocation to (mod,delete) (see previous post)so that if dataset does not exist it is created (and deleted) but what if somebody browse the dataset ?
you would need to test the case.