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.