Robert A. Rosenberg wrote:
As others have told you, the relative GDG number is relative to the start of the job and all the datasets finally get cataloged (and the GDG base gets rolled) at step termination. What I would suggest is at startup do a locate on GDG(0) to find the last GDG number. Add 1 and store this in a shared area. After you do your ENQ, do your allocate with an absolute file name (GDG.G0207V00) and bump the saved 0207 to 0208. When you DEQ and the next task does its allocate it will then allocate G0208V00 and bump the saved GDG number to 0209. When you go to Step End, all the datasets will finally get cataloged and the correct number of old generations will roll off (just make sure that the max number of generations is more than you can create in one execution of your job so that you do not accidentally delete one of the files you just created [due to race conditions it is possible that they will be added out-of-order and you might roll a high numbered generation while keeping a lower numbered one]).
I don't recall the OP stating how the allocation is requested. For a few decades dynamic allocation (direct SVC 99 invocation) has had a GDG bit that requests incrementation of the "current" value, thus allowing a +1 request to generate a unique name. I used this in commercial programs, but do not know whether this will work in the general case, as my allocation were sequential (prior DS closed before next allocation requested).
Gerhard Postpischil Bradford, VT new e-mail address: gerhardp (at) charter (dot) net ---------------------------------------------------------------------- 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

