Afaik delete is done at unallocation of the dd. So the free command should follow the allocate one. But why not just deleteing the dataset without first allocating it?
Itschak On Fri, Apr 1, 2011 at 12:59 PM, Hunkeler Peter (KIUP 4) < [email protected]> wrote: > >//SYSTSIN DD * > > allocate dd(atomic) new delete dsn(TEMP.DUP1) > > delete TEMP.DUP1 > > rename TEMP.DUP2 TEMP.DUP1 > > free dd(atomic) > >//* > > Two cases: > > a) If TEMP.DUP1 exists, then the allocate will fail with RC=12. > In this case the delete, and thus the rename will work. > > READY > allocate dd(atomic) new delete dsn(TEMP.DUP1) > IKJ56893I DATA SET A618725.TEMP.DUP1 NOT ALLOCATED+ > IGD17101I DATA SET A618725.TEMP.DUP1 > NOT DEFINED BECAUSE DUPLICATE NAME EXISTS IN CATALOG > RETURN CODE IS 8 REASON CODE IS 38 IGG0CLEH > READY > delete TEMP.DUP1 > IDC0550I ENTRY (A) A618725.TEMP.DUP1 DELETED > READY > rename TEMP.DUP2 TEMP.DUP1 > READY > free dd(atomic) > IKJ56247I FILE ATOMIC NOT FREED, IS NOT ALLOCATED > > This is the expected result. > > b) If TEMP.DUP1 does not exist, then the delete will fail (because > the data set is allocated to the job), and so the rename will > fail, too. > At least, so I thought. > > READY > allocate dd(atomic) new delete dsn(TEMP.DUP1) > READY > delete TEMP.DUP1 > IDC0550I ENTRY (A) A618725.TEMP.DUP1 DELETED > READY > rename TEMP.DUP2 TEMP.DUP1 > READY > free dd(atomic) > IKJ56247I FILE ATOMIC NOT FREED, IS NOT ALLOCATED > > I'm puzzled the delete is working; will have to think about. > It seems that "delete" does an implicit "free". Interesting. > > Anyway, the important is thing: In neither case did the job loop. > Not sure why it is looping in your case. > > -- > Peter Hunkeler > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

