In most cases, input from the pipe can be obtained by reading
the data from SYS$INPUT; however, when a command procedure is
invoked as a pipeline segment command, SYS$INPUT is redirected to
the command procedure file. To obtain data from the pipe inside a
command procedure, the logical SYS$PIPE can be used.
The following is an example of a pipeline DCL application
TEE.COM:
$ ! TEE.COM - command procedure to display/log data flowing through
$ ! a pipeline
$ ! Usage: @TEE log-file
$
$ OPEN/WRITE tee_file 'P1'
$ LOOP:
$ READ/END_OF_FILE=EXIT SYS$PIPE LINE
$ WRITE SYS$OUTPUT LINE !Send it out to the next stage of the pipeline
$ WRITE tee_file LINE ! Log output to the log file
$ GOTO LOOP
$ EXIT:
$ CLOSE tee_file
$ EXIT
The PIPE command to use TEE.COM can be:
$ PIPE SHOW SYSTEM | @TEE showsys.log | SEARCH SYS$INPUT LEF
The command procedure TEE.COM is used to log the data flowing
through the pipeline. It reads in the data from SYS$PIPE instead
of SYS$INPUT.