Search code examples
vmsopenvmsdcl

waiting on background subprocesses in DCL on VMS


I am looking for a way to launch several background processes to run in parallel with DCL. I would want to wait for them all to complete and know whether they all succeeded or at least one failed. This would be like using & and wait in bash.

I read the docs for spawn/nowait but I don't see a way to wait after spawning multiple subprocesses. I suppose I could have the subproceses write to a file when they exit and check the file from the parent in a sleep-loop? But is there a better/built-in way?


Solution

  • Two reliable means are:

    If you submit them as batch jobs you can use the synchronize command to wait on each in turn.

    Using run/detach to start the processes allows you to specify a /mailbox to receive the termination message.

    Subprocesses are a little different. One approach is to share a logical name table and have each subprocess update its status accordingly. There is no guarantee that an abnormal termination will be reported.

    If you are willing to do some extra work you can create a couple of small applications to use either the lock manager or a common event flag cluster to communicate status updates.