Operating System - OpenVMS
1753939 Members
9776 Online
108811 Solutions
New Discussion юеВ

Spawn command in Asynchronous mode

 
Shashikant_B
Occasional Advisor

Spawn command in Asynchronous mode

Hi All,

Could some one please let me know syntax for a spwan command on OPen VMS?
i need to run a C program from Uniface on Open VMS in asynchronous mode.

If I use this
;spawn_str = "%%spawn_str %%$LIST$"

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 in asynch mode?

Regards,
Rajni.
8 REPLIES 8
Karl Rohwedder
Honored Contributor

Re: Spawn command in Asynchronous mode

You should specify the NOWAIT flag to let the main process continue.

regards Kalle
Joseph Huber_1
Honored Contributor

Re: Spawn command in Asynchronous mode

What Karl was telling: the resulting DCL command should be
SPAWN/NOWAIT/OUTPUT=my.log mycommand param1 param2 ...

This is almost equivalent to
PIPE mycommand param1 param2 ... > my.log &

Whatever it means in Uniface syntax is beyond my knowlege.

SPAWN is the original VMS way of executing a command in a (asynchroneous) sub-process.
The later PIPE command was added to approach the syntax and behaviour of Unix systems.

As seen in previous threads, You think it is necessary to combine spawn and some other async program execution (creprc or pipe).
Only one or the other method is o.k..
I see no sense in Spawning a PIPE, it just creates another subprocess-level.
Or are You thinking on some combination of fork/exec(l,v,vp) in Unix ?

And: whatever method of async execution You choose, always redirect output to some file (except in interactive tests on a terminal),
SPAWN/OUTPUT=
PIPE ... > logfile

And not to forget: in VMS there is HELP !
http://www.mpp.mpg.de/~huber
Hein van den Heuvel
Honored Contributor

Re: Spawn command in Asynchronous mode

Hello Rajni,

Because readers here are unlikey to be familiar with Uniface rules, you may have to help us understand that.

When you mention 'spawn' we expect you are talking about the RTL Library routine LIB$SPAWN or the DCL command 'SPAWN'.

The RTL function have a 4th argument (see doc) which is flag where bit-0 (value 1) indicates that the main process should not wait for the completion of the sub-process to be created.
A similar flag is available in DCL (/NOWAIT).
In both cases the child can continue asynchroneously, but *must* finish before the parent stops, otherwise it will be killed.

An alternative is to create a detached process, which is also async. Please check the VMS doc for details, notably the system service SYS$CREPRC.

If the Spawn call is made by Uniface code, then tt is not clear to me whether you can pass along that flag or not. Check with Uniface (documentation).

hth,
Hein.
Shashikant_B
Occasional Advisor

Re: Spawn command in Asynchronous mode

Hi All,

Thanks for the replies.
The syntax which i have written here is from Uniface.
Am not able to run the DCL script in asynch mode from Uniface.

Regards,
Rajni.
Joseph Huber_1
Honored Contributor

Re: Spawn command in Asynchronous mode

Uniface, as a commercial product, probably has a support line, why not ask them.

Just clearly state, what You really intend to produce on the VMS side:
Does SPAWN/NOWAIT/OUTPUT=my.log mycommand p1 p2
work directly under VMS/DCL ?

If yes, then it is up to Uniface to produce the right call-frame or request to execute this DCL command on a target VMS system.

Apparently noone here in this forum has experience with Uniface (?) .

If the above does not work directly on VMS, then tell us what does not work, error messaqges etc.
http://www.mpp.mpg.de/~huber

Re: Spawn command in Asynchronous mode

Rajni,

Please bare in mind that a subprocess (spawn, LIB$SPAWN, LIB$DO_COMMAND etc) is a subprocess and therefore killed the moment the main (owner) process dies. (logs off or killed otherwise).
To create an independant process (a detached process) you could use something like RUN SYS$SYSTEM:LOGINOUT.EXE or SYS$CREPRC.

Regards,
Martin Hoogenboom
This must be Thursday, I never could get the hang of Thursdays.
Phil.Howell
Honored Contributor

Re: Spawn command in Asynchronous mode

my (ancient) knowledge of uniface on vms is that there is a uniface server process running in a batch queue, and all work is done in the context of this process.
Have a look in authorize for a uniface username/uic and check quotas/limits eg. prclm.
Also check the accounting log for the uniface account, and log files under uniface directories.
Phil
Hein van den Heuvel
Honored Contributor

Re: Spawn command in Asynchronous mode


Rajni also posted this question in comp.os.vms.

John Briggs seems to have given a good answer there.

Hein.

http://groups.google.com/group/comp.os.vms/browse_frm/thread/77298c3296583c01/#