/sys$common/syshlp/HELPLIB.HLB  —  PIPE  Description
    The PIPE command allows you to perform UNIX style command
    processing by executing multiple DCL commands in a single command
    line. You can use the PIPE command to execute DCL commands in a
    number of ways:

    o  Multiple command execution

       Multiple DCL commands are specified in a single PIPE command
       and executed sequentially. The syntax for multiple command
       execution is as follows:

       PIPE   command-sequence ; command-sequence [; command-sequences]...

    o  Conditional command execution

       A command sequence is executed conditionally depending on the
       execution result of the preceding command sequence.

       Using the following form, command-sequence2 executes if, and
       only if, command-sequence1 succeeds:

       PIPE   command-sequence1   &&   command-sequence2

       Using the following form, command-sequence2 executes if, and
       only if, command-sequence1 fails:

       PIPE   command-sequence1   ||   command-sequence2

    o  Pipeline command execution

       A pipeline is formed by connecting DCL commands with pipes as
       follows:

       PIPE pipeline-segment-command | pipeline-segment-command [|...]

       Each pipeline-segment command runs in a separate subprocess
       with its SYS$OUTPUT connected to the SYS$INPUT of the next
       pipeline-segment command. These subprocesses execute in
       parallel; however, they are synchronized to the extent that
       each pipeline-segment command, except the first, reads the
       standard output of its predecessor as its standard input. A
       pipeline finishes execution when the last pipeline-segment
       command is done.

       It is very common to use filter applications in a pipeline.
       A filter application is a program that takes data from
       SYS$INPUT, transforms it in a specific way, and writes it
       to SYS$OUTPUT.

    o  Subshell execution

       Command sequences can be executed in a subprocess environment
       by using the subshell execution form:

       PIPE   ( command-sequence [separator command-sequence]... )

       The command sequences in a subshell are executed in a
       subprocess environment. DCL waits for the subshell to complete
       before executing the next command sequence. The ( ) separator
       is similar to the SPAWN/WAIT command.

    o  Background execution

       Command sequences can be executed in a subprocess environment
       by using the following form:

       PIPE  command-sequence [ separator command-sequence]...  &

       DCL does not wait for the command sequences to finish. Control
       passes back to DCL once the background subprocess is created.

    o  Input/output redirection

       A command sequence can redirect its SYS$INPUT, SYS$OUTPUT,
       or SYS$ERROR to a file during execution of the command as
       follows:

       To redirect SYS$INPUT:

          PIPE    command-sequence < redirected-input-file

       To redirect SYS$OUTPUT:

          PIPE    command-sequence > redirected-output-file

       To redirect SYS$ERROR:

          PIPE    command-sequence 2> redirected-error-file

       A pipeline-segment command can also redirect its SYS$INPUT,
       SYS$OUTPUT, or SYS$ERROR; however, SYS$OUTPUT redirection
       is allowed only for the last pipeline-segment command, and
       SYS$INPUT redirection is allowed only for the first pipeline-
       segment command.

    You can interrupt a PIPE command by pressing Ctrl/Y. If the
    PIPE command is executing in a pipeline or a subshell command
    sequence, the command sequence and the PIPE command are deleted.
    In this case, a CONTINUE command entered immediately after the
    interrupt will not resume the execution of the PIPE command.

    If the PIPE command is executing a command sequence other than
    a subshell or a pipeline command sequence, DCL behaves as if the
    command sequence were entered as a DCL command without the PIPE
    command verb and interrupted by Ctrl/Y. See the OpenVMS User's
    Manual for more information on the Ctrl/Y interrupt.

    Each command sequence sets the global symbol $STATUS with a
    returned value after it finishes execution. The return status
    of the PIPE command is the return status of the last command
    performed in the last segment. If all segments fail with some
    kind of error and the last segment returns with success, the
    status returned to DCL is the success.

    When a PIPE command is executed in a command procedure with the
    ON condition processing, the conditional execution of command
    sequences (&&, ||) takes precedence over the action previously
    specified by the ON condition statement.
Additional Information: explode extract
DCL Command Restrictions Improving Subprocess Performance Input/Output Redirection Pipelines and TEEs
Close Help