Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!NIHKLMB.BITNET!GHC
From: GHC@NIHKLMB.BITNET
Newsgroups: comp.os.vms
Subject: BITNET Mail follows
Message-ID: <8807082006.AA22267@ucbvax.Berkeley.EDU>
Date: 24 Jun 88 17:05:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 38

Date: 24-JUN-1988 10:04:30.69
From: Gerson H Cohen 
To  : 
Original To: GATEWAY::"info-vax@kl.sri.com",GHC
Subj: Re: Spawn from detached process. Resolution

In view of the numerous responses that I have received about my problem
using LIB$SPAWN from a detached process, I feel that a posting of the
resolution is required.  Several different approaches were presented; all but
one are correct.  The problem derives from the fact that my detached process
was scheduled without invoking SYS$SYSTEM:LOGINOUT.EXE.  Hence there is no
CLI available even to carry out the spawn operation.  The erroneous
suggestion is to simply include the CLI (DCL) as the last argument to
LIB$SPAWN; with no CLI the call itself cannot be serviced.  Proposed were:

1) Fire up the original detached process with
   RUN/UIC.../INPUT=...COM SYS$LOGIN:LOGINOUT.EXE instead of directly.

2) Use $CREPRC and create a subprocess using the command file I wanted in the
   BATCH as input.  The log file would be specified as output.

3) Use $SNDJBC.  (I acknowledge a pretty piece of VAXC code).

4) Have the parent process write a command file and close it with DISP=SUBMIT.

My problem has several limitations with tend to force the selection of only
two of the above solutions.  My original effort was a bit cloddy and spawned
a process to submit a process.  Let's do it in only one step.  The ultimate
process may be run as a subprocess (it will for a start) or as a batch
process (it will ultimately). Since I want to direct the log file to a
particular place, option 4 is not best.  Option 1 requires changing the
philosophy of a third party product which I am modifying in this effort.  I
settled on option 2 as the easiest to code, creating a subprocess in which I
can test the program which will ultimately become a part of the package.  I
do think that option 3 is the cleanest approach and will be the ultimate
choice, but first I have to learn how to select the proper batch queue, pass
the required parameter and specify the location of the output log.

My sincere thanks to all who took the time to write.