On Thu, 16 Oct 2014 20:27:27 -0500, Walt Farrell wrote:
>
>>Working on a general purpose callable subroutine to connect to a remote DB2 
>>subsystem and return values back to the caller.
>>
>>Since the caller may [and WILL] have established its own DB2 connection to a 
>>local DB2 subsystem, possibly with some cursors open and DB2 locks acquired, 
>>the subroutine must run under a different TCB.
>
>You might consider going a bit further, and using fork() and execmvs() to 
>create a new address space running your new code. That will isolate it quite 
>well from the original task. And since you will not get control to signal it 
>to terminate, it might do so after some period of time without hearing from 
>you, say 5 minutes or whatever value you consider reasonable. 
>
fork() should return a descriptor that the parent can use to kill() the child.
I don't know that meets the "quietly" requirement.  The child could trap
the signal and terminate in an orderly manner.  (Does execmvs() return
a PID?)

A possible disadvantage is that neither fork() nor execmvs() propagates
DD statements.  This can be merely cumbersome in that the child must
perform its own allocations, or more serious if ENQ conflicts result.
Descriptors, however, are propagated by fork() and (I've been told)
by execmvs(), so the parent can communicate with the child via pipes.

Since (I believe) execmvs() creates a new address space, spawn()
might be as effective as fork().

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to