HP OpenVMS Systems

ask the wizard
Content starts here

Passing parameters to detached processes?

» close window

The Question is:

 
The DCL RUN (detached) PROCESS command does not support passing arguments to
 main( argc, argv). Neither does SYS$CREPRC(). How can I pass args to main() of
 a detached process without using SUBMIT? How does SUBMIT do it?
Thank you very much.
 
 


The Answer is :

 
    SUBMIT does not pass arguments to an image running a detached process,
    rather it passes arguments to the CLI of a detached process. See F$GETQUI
    function "DISPLAY_ENTRY" item codes "PARAMETER_1" through
    "PARAMETER_8".
 
    This mechanism is completely different from the C language specific
    argc/argv mechanism, though argc/argv also depends on the CLI to
    communicate the arguments to the running program.
 
    The command "RUN/DETACHED image" creates a process running the
    specified image WITHOUT a CLI. This means there are a number of
    features which cannot be used within this image. For example,
    LIB$SPAWN, LIB$SET_LOGICAL and argc/argv among others.
 
    It is not necessary to use SUBMIT to pass arguments to a detached
    process, but it IS necessary to have a process running under a CLI. This
    can be achieved by specifying the image SYS$SYSTEM:LOGINOUT.EXE to the
    RUN command and feeding it DCL commands through SYS$INPUT. For example
 
    DETACH.COM
 
$ myprog="$device:[directory]myprog.exe" ! Define foreign command
$ myprog arg1 arg2 arg3                  ! invoke the image with args
$ EXIT
 
    Command to start the detached process
$ RUN/DETACHED/INPUT=device:[directory]DETACH.COM SYS$SYSTEM:LOGINOUT.EXE
 
 
    Depending on the exact needs, you may find it necessary to dynamically
    generate the input command procedure to change argument values.  Or
    you could pass the commands and the parameters to the created process
    via an input mailbox, reading output data back via another mailbox.
 
    You may also be able to use DECnet task-to-task (client-server network
    communications), or a webserver CGI script or other similar approach.
    Or a file.
 
    Within DCL, examples of client-server network communcations are
    available in the OpenVMS documentation set and within the Digital
    Press Writing Real Programs in DCL book.  Network communications
    are covered in the DECnet documentation as well as the TCP/IP
    Programming documentation.
 
    Existing discussions of the f$getqui lexical include the following
    topics: (813), (1240), (2159), (3951), (4546), (4568), (4903), (5188)
    (5471), (5567), (5651), (5793), (5982), (6315), (6877), etc.
 
 

answer written or last revised on ( 15-AUG-2001 )

» close window