Page 1 of 1

Reallocate SYSIN with DYNALLOC

PostPosted: Mon Sep 21, 2009 11:15 am
by momi sabag
Hi

I want an assembler code that is executed using a JCL job to reallocate the SYSIN ddname that was allocated in the JCL to a different file. I have tried to do it using the DYNALLOC macro. My macro invocations returns code 0 when I try to deallocate SYSIN, but nothing really happens (it remains allocated).
Has anyone done such a thing before and can point me in the right direction?

Thanks

Re: Reallocate SYSIN with DYNALLOC

PostPosted: Tue Jun 15, 2010 7:53 pm
by steve-myers
I just happened on this. I remembered encountering something like this long ago. I went to the manual (the manual is your friend!) and found DUNUNALC:
U        DC    A(X'80000000'+URB)
URB      DC    AL1(S99RBEND-S99RB,S99VRBUN,0,0)
         DC    2AL2(0)
         DC    A(UTXTPP,0,0)
UTXTPP   DC    A(UTXT02,X'80000000'+UTXT01)
UTXT01   DC    AL2(DUNDDNAM,1,L'UDDN)
UDDN     DC    C'SYSIN'
UTXT02   DC    AL2(DUNUNALC,0)
That worked perfectly!

Re: Reallocate SYSIN with DYNALLOC

PostPosted: Thu Dec 02, 2010 8:03 pm
by steve-myers
Dynamic allocation is described here. Read it! The data areas in my code snippet are described in 'SYS1.MACLIB(IEFZB4D0)' as well as in the manual. The dynamic allocation text unit keys are in 'SYS1.MACLIB(IEFZB4D2)' and are described in detail in the manual..

For better or worse dynamic allocation is relatively easy to use, though I find the code snippets in the manual hard to follow because they are taking a relatively simple data structure and building it dynamically. My code snippet in the post aimed to reduce the dynamic allocation data structures to their simplest possible form, though it can't be used as is in reenterable code.

Quite honestly, I don't use dynamic allocation in the way the manual tells me to use it because it requires too much code and it hides a fairly simple data structure. The method I use when I must use reenterable code is also hard to follow, though I don't think it's as bad as IBM's method, and it certainly uses much less code.

Before I wrote that post I wrote a simple test program to verify it worked as I expected, and I used the exact code snipppet I put in the post in that program to free the SYSIN allocation.

I think the failure of dynamic allocation to actually free the original SYSIN allocation is worth opening a PMR (that's the IBM term for a problem report) but I'm not in a position these days to do it.

Re: Reallocate SYSIN with DYNALLOC

PostPosted: Fri Dec 03, 2010 2:02 am
by steve-myers
Just to expand on my last paragraph. The reason dynamic allocation did not free the SYSIN in the original post is the allocation had the "permanently allocated" attribute because it was allocated by a DD statement (or by dynamic allocation with the undocumented DALPERMA key). My issue is not that dynamic allocation did nothing, but that it did not fail the request with an appropriate reason and error code.