Using Spawned Processes

The ZSYSTEM command creates a subprocess of the current process in a fashion analogous to the DCL SPAWN command.

The ZSYSTEM command creates a new process called the child process, and passes its argument to a Command Language Interpreter (generally DCL) for execution. The new process executes in the same directory as the initiating process. The new process has the same VMS enviroment, such as logical names and input/output devices, as the initiating process. The initiating process pauses until the new process completes before continuing execution.

Example:

        GTM>ZSYSTEM
        $ DIRECTORY dmex.*
        Directory USER: [SMITH]
        DMEX.M;6 DMEX.M;5 DMEX.M;4 DMEX.M;3
        DMEX.M;2 DMEX.M;1 DMEX.OBJ;3 DMEX.OBJ;2 DMEX.OBJ;1
        Total of 9 files
        $ SHOW PROCESS/SUB
        There are 2 processes in this job:
        SMITH
        SMITH_1(*)
        $ATTACH
        _Process: SMITH
        GTM>
        

This uses ZSYSTEM to create a subprocess called SMITH_1. Note that the asterisk (*) following SMITH_1 identifies the currently active sub process. Notice that the results of the DIRECTORY command at the DCL prompt shows source (indicated by a .M extension) and object files (indicated by a .OBJ extension) for the routine dmex. The SHOW PROCESS/SUB command shows the main process SMITH, and the newly created subprocess SMITH_1(*). The ATTACH command passes execution control to the process named SMITH and leaves the SMITH_1 subprocess in existence; a LOGOUT command would also return control to SMITH, but would terminate SMITH_1.