q From:	HENRY::IN%"McGuire_Ed%grinnell.mailnet%mit-multics.arpa%sri-kl.ARPA%relay.cs.net@rca.com" 20-MAR-1987 21:03  To:	INFO-VAX@sri-kl.arpa  Subj:	Re: Multiple VMS processes    K   >>  H. Steinberg (?) writes of a nifty feature wherein one can gain a new A   >>  prompt and do things under Unix on receipt of a ^Z type-in. C   >>            I've seen this done under VMS by typing ^Y and then B   >>  various SPAWN/NOWAIT commands and continue commands. [. . .]   >>            Glenn Everhart   >>  Everhart%Arisia@RCA.com    > G   >  It sounded if the UNIX feature the person was asking for wasn't an F   >  interrupt. Suppose I'm running something that will take awhile toO   >  complete.  I want to create a subprocess, but I want the parent process to M   >  continue working.  I don't know how to do that, but I'd love to find out    >  if it's possible!   It's done as follows: I           1)  If you've got NOCONTROL_Y set, you're out of luck; it can't                be done.O           2)  Hit a control-Y (not a control-C, since the image may be trapping J               for control-C's, in which case, you won't get what you want.H           3)  Type the command "SPAWN/NOWAIT" with any other appropriateI               qualifiers you might want:  e.g., it's easier to keep track Q               of what's going on if you use a distinct prompt for the subprocess, J               if you have SYS$COMMAND or SYS$OUTPUT directed away from theJ               terminal, you'll want to explicitly direct them back for the$               subprocess, and so on.K           4)  Once the subprocess is spawned, issue the CONTINUE command to O               the original process.  You've now accomplished what was described                above.  M In some ways, this is superior to the UNIX version; in others, it's decidedly I worse.  If you log out of the subprocess, you automatically find yourself I talking to the previously "background" process again.  On the other hand, I if the original process decides it wants terminal input, the only warning H you'll have is that it will issue its own prompt (which is why I suggestL a different prompt for the subprocess.  There is one big gotcha here though., It's illustrated by the following procedure:1           $         IF P1 .NES. "" THEN GOTO NEXT %           $         SET CONTROL=(T,Y) >           $         SPAWN/NOWAIT/INPUT='F$TRN("SYS$COMMAND") -5           $                   @'F$ENV("PROCEDURE")' X O           $ LOOP:   WRITE SYS$OUTPUT F$TIME, " F$ENVIRONMENT(""CONTROL"") = ",- ,           $         F$ENVIRONMENT("CONTROL")$           $         WAIT 00:01:00.00           $         GOTO LOOP 8           $ NEXT:   SPAWN/INPUT='F$TRN("SYS$COMMAND")' -<           $                   ATTACH/ID='F$GETJPI("","PID")'3           $         WRITE SYS$OUTPUT "STOPPING JOB"            $         STOP /ID=0M What this does is as follows: You invoke the procedure without any arguments; M The procedure spawns an ASYNCHRONOUS subprocess which reinvokes the procedure I with an argument.   Meanwhile, the original process starts, at one-minute G intervals, whether control-t and control-y are enabled or disabled. The N subprocess now spawns a SYNCHRONOUS subprocess which immediately reattaches toO the first subprocess, which then commits suicide, killing the second subprocess K at the same time, of course.  Now here's the fun part: Though the procedure F explicitly enabled both control-t and control-y, and though it's stillN reporting them as being enabled, you'll have to go elsewhere to stop executionJ of this procedure:  You see, the second subprocess was given access to theL interrupts when it was created as a synchronous subprocess; when it attachedJ to the first subprocess, it passed access to the signals to it.  The firstJ one, however, being asynchronous, felt no onbligation to inform its parentI process when it killed itself, and the second subprocess didn't even know K about the original process.  Thus, the process you're left with is ignoring G the interrupts, assuming they will be serviced by one of its (no longer E extant) subprocesses, and will continue to do so until it receives an K appropriate termination message in a temporary mailbox.  Of course, there's J no subprocess to send it a termination message anyjore, so you either haveO to make a good guess and manually copy the appropriate messaage to the mailbox, C or else log in elsewhere and delete the stalled process.  Have fun. 