HELP SPAWN — VMS 4.6
Creates a subprocess of the current process. Portions of the
current process context are copied to the subprocess.
Format:
SPAWN [command-string]
Additional information available:
ParametersCommand QualifiersExamples
Parameters
command-string Specifies a command string to be executed in the context of the created subprocess. When the command completes, the subprocess terminates and control is returned to the parent process. If you use both the /INPUT qualifier and a command string, commands are obtained from the input file after the specified command string executes. The command string cannot exceed 132 characters.
Command Qualifiers
Additional information available:
/CARRIAGE_CONTROL/CLI/INPUT/KEYPAD/LOG/LOGICAL_NAMES
/NOTIFY/OUTPUT/PROCESS/PROMPT/SYMBOLS/TABLE/WAIT
/CARRIAGE_CONTROL
/CARRIAGE_CONTROL /NOCARRIAGE_CONTROL Determines whether carriage return/line feed characters are prefixed to the subprocess's prompt string. By default, SPAWN copies the current setting of the parent process.
/CLI
/CLI=cli /NOCLI Specifies the name of an alternate command language interpreter (CLI) to be used by the subprocess. If the /CLI qualifier is not specified, the CLI used will be the same as the parent process. The CLI you specify must be located in SYS$SYSTEM and have the file type EXE.
/INPUT
/INPUT=file-spec
Specifies an input file containing one or more DCL commands to be
executed by the spawned subprocess. If you specify a command string
with the SPAWN command and an input file with the /INPUT qualifier,
the command string is processed before the input file. Once
processing of the input file is complete, the subprocess is
terminated.
No wildcards are allowed in the file specification.
You cannot explicitly specify non-record-oriented process permanent
files (NRO PPFs) with the /INPUT qualifier. The system displays an
error message when it encounters such a file as the value for
/INPUT.
Note that when NRO PPFs are used as implicit input (that is, /INPUT
is not specified and SYS$INPUT is a NRO PPF), the SPAWN command can
succeed. The following chart shows what happens.
Process Type SYS$INPUT Implicit Input
Interactive NRO PPF SYS$COMMAND
Non-interactive NRO PPF Null Device
Any Any other SYS$INPUT
If SYS$INPUT is a terminal, it cannot have an associated terminal
mailbox.
/KEYPAD
/KEYPAD (default) /NOKEYPAD Determines whether keypad symbols and the current keypad state are copied from the parent process to the subprocess. By default, if you have established key definitions and/or states with the DEFINE/KEY and/or SET KEY commands, these settings are copied to the subprocess. Use the /NOKEYPAD qualifier if you do not want the key settings to be copied.
/LOG
/LOG (default) /NOLOG Controls whether the assigned subprocess name is diplayed along with any messages indicating transfer of control between processes.
/LOGICAL_NAMES
/LOGICAL_NAMES (default) /NOLOGICAL_NAMES Determines whether the system passes process logical names and logical name tables to the subprocess. By default, all process logical names and logical name tables are copied to the subprocess except those explicitly marked CONFINE or created in executive or kernel mode.
/NOTIFY
/NOTIFY /NONOTIFY (default) Controls whether a message is broadcast to the terminal at which you are logged in, notifying you that your subprocess has been completed or aborted. This qualifier should not be used unless you specify the /NOWAIT qualifier. /NOTIFY also cannot be specified when the SPAWN command is executed from within a non-interactive process. Note that messages broadcast as a result of specifying the /NOTIFY qualifier are considered to be DCL messages. Therefore, if SET BROADCAST=NODCL is in effect, all such notification messages will be suppressed.
/OUTPUT
/OUTPUT=file-spec
Requests that the output from the SPAWN operation be written to the
specified file.
Note that if both the /OUTPUT and /NOWAIT qualifiers are used
interactively, and if SYS$COMMAND is specified as the /OUTPUT file
specification, the output from both your parent process and your
subprocesses will be displayed simultaneously at your terminal.
No wildcards are allowed in the file specification.
You cannot explicitly specify non-record-oriented process permanent
files (NRO PPFs) with the /OUTPUT qualifier. The system displays an
error message when it encounters such a file as the value for
/OUTPUT.
Note that when NRO PPFs are used as implicit output, the SPAWN
command can succeed. The following chart shows what happens.
Process Type SYS$OUTPUT Implicit Output
Any NRO PPF Mailbox transmitting records for
parent to write to its current
SYS$OUTPUT device
Any Any other SYS$OUTPUT
If you omit the /OUTPUT qualifier, output is written to the current
SYS$OUTPUT device.
/PROCESS
/PROCESS=subprocess-name
Specifies the name of the subprocess to be created. If you specify a
process name that already exists, an error message is displayed. By
default, if you omit the /PROCESS qualifier, a unique process name
is assigned with the same base name as the parent process and a
unique number. The default subprocess name format is:
username_n
If the /LOG qualifier has been specified, the assigned name of the
subprocess is displayed.
/PROMPT
/PROMPT[=string] Specifies the prompt string for DCL to use in the subprocess. By default, SPAWN copies the current prompt from the parent process. The string can consist of more than one character. All valid ASCII characters can be used in the string. In order to include spaces, lowercase letters or non-alphanumeric characters in your string, you must enclose the string in quotation marks. Otherwise, letters are automatically converted to uppercase, and leading and trailing spaces are removed. If no string is specified, the DCL default prompt string "$ " is restored.
/SYMBOLS
/SYMBOLS (default) /NOSYMBOLS Determines whether the system passes DCL global and local symbols to the subprocess. Note that the $RESTART, $SEVERITY, and $STATUS symbols are never passed to the subprocess.
/TABLE
/TABLE=command-table Specifies the name of an alternate command table to be used by the subprocess.
/WAIT
/WAIT (default) /NOWAIT Controls whether the system waits until the current subprocess is completed before allowing more commands to be issued in the parent process. The /NOWAIT qualifier allows you to issue new commands while the specified subprocess is running. When you use the /NOWAIT qualifier interactively, be sure to use the /OUTPUT qualifier as well so that output from the subprocess is directed to a file rather than to your terminal. Otherwise, your terminal will be used by more than one process at the same time. Note that specifying the /NOWAIT qualifier will cause both input and output to be shared with the parent process. If the input device is a terminal, control characters, such as CTRL/T or CTRL/Y, will also affect all subprocesses sharing the input device. CTRL/Y, for example, will interrupt all such subprocesses. This problem may be avoided by specifying /INPUT=NL:.
Examples
1. $ RUN MYPROG
.
.
.
$ ^Y
$ SPAWN MAIL
%DCL-S-SPAWNED, process SMITH_1 spawned
%DCL-S-ATTACHED, terminal now attached to process SMITH_1
MAIL> READ
.
.
.
MAIL> EXIT
%DCL-S-RETURNED, control returned to process SMITH
$ CONTINUE
The SPAWN command in this example allows you to enter the VAX/VMS
Mail Utility without terminating the currently running program.
After you exit from MAIL, control is returned to the parent process.