We want to run a C code from Uniface program on OPen VMS in
asynchronous mode.
Platform - OpenVMS
We are running a spawn command from the uniface program.
;spawn_str = "%%spawn_str %%$LIST$"
When I do spawn ----C pgm-----, it runs the program in synchronous
mode.
But I want to run this C pgm in Asynch mode, as per the documentation,
if I use PIPE (-------)&, it doesnt work.
;spawn_str = "PIPE ( %%spawn_str %%$LIST$ ) &"
Could some one please let me know how to run it in asynch mode?
Please let me know what should be the spwan command syntax in this
case.
Regards,
Rajni.
I don't know the syntax of the Uniface program, but to spawn a program
and not wait for the completion use the :"/nowait" qualifier:
$ spawn/nowait ....
$ help spawn
will give you most the help you need..
Ken
The first thing you need to do is learn to use the HELP command!
Once you do that, you'll read about the /NOWAIT qualifier for SPAWN.
--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. Fax: 724-529-0596
DFE Ultralights, Inc. E-Mail: da...@tsoft-inc.com
170 Grimplin Road
Vanderbilt, PA 15486
It took me a while to decipher what you were trying to do and why
it was failing. The obscure syntax and the undocumented variables
you are using don't help matters.
As I understand things:
The semicolon is a Uniface syntax that indicates that a system command
is to be executed. The text on the right hand side is passed to the
CLI for execution and the variable on the left hand side is populated
with the result of that execution.
The %% notation allows for parameter substitution inside a quoted
string.
This construct allows for the synchronous execution of one shell
command.
But you want asynchronous execution in the background.
And so the obvious approach is to do synchronous execution of
a shell command that will trigger tha asynchronous execution of
the background command(s).
And that's what the PIPE (command-sequence) & syntax is intended to
accomplish.
The reason this is failing is that the parent command is still
synchronous. Once its work is done, it will still terminate and
return control to Uniface. If it spawns an asynchronous child
process before returning, that child will be orphaned.
VMS does not allow orphaned subprocesses. It kills them.
The only solution I know of is to run a detached process instead.
$ RUN /DETACH /INPUT=disk:[dir]your-command-file.com
/OUTPUT=disk:[dir]your-log-file.log SYS$SYSTEM:LOGINOUT.EXE
HELP RTL LIB LIB$SPAWN
There is a flag you can set to have in "nowait" state (asynchronous).
Also, you can create mailboxes ( HELP SYS $CREMBX ) and feed those
mailboxes as input and output of the subprocess. You can write commands
to the mailbox to have them executed, and the subprocess lives on, so it
is more efficient since each command re-uses the existing subprocess.