[mod.computers.vax] LIB$SPAWN

gayman@ARI-HQ1.ARPA ("%*Gayman, Beth") (03/06/87)

LIB$SPAWN question:

Does LIB$SPAWN work from a detached process?  I have a simple program that
works fine until I try to RUN/DETACH.  Any comments welcome.  I have included
the code to illustrate.
+++++++++++++++++++++++ Begin here ++++++++++++++++++++++++++++++++++++++++++
;
;UPS.MAR
;
	.LIBRARY	"SYS$LIBRARY:LIB.MLB"
C_STRING:	.ASCII	!MAIL/SUBJECT="TEST MAIL MESSAGE" !
		.ASCII	!NL: GAYMAN!
C_STRING_LENGTH=.-C_STRING
C_STRING_DESC:
	.WORD	C_STRING_LENGTH
	.BYTE	DSC$K_DTYPE_T
	.BYTE	DSC$K_CLASS_S
	.ADDRESS	C_STRING
;
	.ENTRY	UPS	^M <>  
	PUSHAQ	C_STRING_DESC
	CALLS	#1,G^LIB$SPAWN	
	BLBC	R0,ERROR
	MOVL	#1,R0
ERROR:	$EXIT_S	R0
	.END	UPS
++++++++++++++++++++++ The End. +++++++++++++++++++++++++++++++++++++++++++++

Elizabeth Gayman (GAYMAN@ARI-HQ1.ARPA)
------
------

gwalker@SPCA.BBN.COM.UUCP (03/07/87)

I have often seen problems with programs that work fine when run normally
but don't work when run with /detach. I think it has always turned out
to be the case that the detached process gets confused about what its
input, output, and error channels are.

I suspect if you did the RUN/DETACH and specified the input, output, and error
to be some file or NLA0: OR if you modified the program to pass the input and
output arguments to lib$spawn as NLA0:, it would probably work.

-- Gail Walker

ken@HAMLET.CALTECH.EDU.UUCP (03/07/87)

> Does LIB$SPAWN work from a detached process?	I have a simple program that
> works fine until I try to RUN/DETACH.  Any comments welcome.	I have included
> the code to illustrate.

  Sometimes. The spawn function is preformed by DCL (the CLI).	If
the detached process is started with loginout then it will have a CLI
and be able to use LIB$SPAWN.

  If you start the process with RUN/DETACH PROGRAM.EXE the process
does not have a CLI and cannot use LIB$SPAWN.

  If you start the process with RUN/DETACH
SYS$SYSTEM:LOGINOUT/INPUT=PROGRAM.COM where PROGRAM.COM can be a
one-liner of "$ RUN PROGRAM", then the LOGINOUT which runs before
your program maps the CLI and your program can use LIB$SPAWN.

						    Kenneth Adelman
						    Caltech