Sunday, October 30, 2011

Manipulating SYSEXEC

SYSEXEC is a funny bird.  In most MVS-like environments, when SYSEXEC is opened, it stays open until something closes it.  Since it's OPEN, it can't be FREEd, therefore you cannot concatenate an additional dataset to it.  There is, of course, ALTLIB, but if the routine doing the ALTLIB is not already in the concatenation somewhere, calling it might be problematical.

So, here's the problem:  you have to hook another dataset into SYSEXEC and the system is not cooperating.  What now, my love?  (Hey, wouldn't that make a great title for a song?)

Let us look at how SYSEXEC got rigged to OPEN and stay open.  When it was first ALLOCated, it was marked (by EXECUTIL) like this:

"EXECUTIL EXECDD(NOCLOSE) SEARCHDD(YES)"
and that has to be thwarted.  Not a problem.
"EXECUTIL EXECDD(CLOSE)"
and follow it with a call to any routine in SYSEXEC.  As soon as the called function completes, SYSEXEC will close.  (If you just want SYSEXEC closed and you don't really want to do anything, it would be good if SYSEXEC had an IEFBR14-equivalent, a little NOOP program that starts and ends in the same gasp.  It can't, by the way, be in an ALTLIB'd dataset searched ahead of SYSEXEC.  It must be in the real SYSEXEC allocation.)

This is what ATTACH does (see my REXX page for the gory details).  Once SYSEXEC is closed, you can reallocate it as you need it.  Don't forget to

"EXECUTIL EXECDD(NOCLOSE) SEARCHDD(YES)"
when you're done ;-)

No comments:

Post a Comment