OUT stage v1.2

Pipelines v2.0

 

Purpose, Operands, Streams used, Usage notes, Examples, See also

Home

 

Syntax

 

          _0______

>>__OUT__|________|____________________________________________________________________><

         |_stream_|

 

Purpose

 

OUT is dual purpose. Use the OUT stage to read records from its primary input stream and write them to the specified target stream and to its primary output stream, if it is connected. OUT appends a Line-Feed character to each output record that it writes to the specified target stream, primary output stream records are written unchanged.

 

    

When OUT is specified in a pipeline that has been launched by the CALLPIPE stage command of the calling pipeline; the target stream operand corresponds to the specified output stream of the CALLPIPE stage. In other words, records that are written by OUT to stream 0; flow back into the CALLPIPE stage and out through its primary output stream, and records that are written by OUT to stream 1; flow back into the CALLPIPE stage and out through its secondary output stream. Records that are intended for a CALLPIPE output stream that is not connected; are discarded.

 

    

When OUT is specified in a pipeline that has not been launched by the CALLPIPE stage command of a calling pipeline; records that are written to stream 0 are routed to the system output stream; STDOUT. Records that are written to stream 1, are routed to the system output stream; STDERR.

 

Operands

 

    

stream

is an unsigned integer which specifies an output stream number.

 

Streams used

 

The following streams are used by the OUT stage:

 

Stream

Action

 

 

Primary input stream

OUT reads records from its primary input stream.

Target output stream

When OUT is specified in a pipeline that has been launched by the CALLPIPE stage command of the calling pipeline; the target stream operand corresponds to the specified output stream of the CALLPIPE stage.. In other words, records that are written by OUT to stream 0; flow back into the CALLPIPE stage and out through its primary output stream and records that are written by OUT to stream 1; flow back into the CALLPIPE stage and out through its secondary output stream. Records that are intended for a CALLPIPE output stream that is not connected are discarded.

 

When OUT is specified in a pipeline that has not been launched by the CALLPIPE stage command of a calling pipeline; records that are written to stream 0 are routed to the system output stream; STDOUT. Records that are written to stream 1 are routed to the system output stream; STDERR.

Primary output stream

OUT writes records to its primary output stream, if it is connected.

 

Usage notes

 

     1)

OUT does not delay the records.

 

     2)

After writing a record to the specified target stream; OUT writes that same record to its primary output stream, if it is connected.

 

     3)

You should only specify a single OUT stage command in any one set of pipelines; otherwise the results may be unpredictable.

 

     4)

OUT is designed to work in conjunction with the CALLPIPE stage command and the standard output streams; STDOUT and STDERR.

 

     5)

OUT verifies that its secondary input and output streams are not connected and then begins execution.

 

Examples

 

When the following pipeline is called by the CALLPIPE stage command of a calling pipeline; it reads input records from CALLPIPE and writes output records back to CALLPIPE. However, when the same pipeline is called in any other way; it reads records from STDIN and writes records to STDOUT. The actual pipeline changes any occurrence of the word ifdef  to ifndef and writes the records to its output.

 

mypipe.rex
 
**** Top of file ****
01 Address Rxpipe
02
03 ‘pipe in | change /ifdef/ /ifndef/ | out’
04
05 Exit 0
**** End of file ****

 

See also

 

Reference the following links for additional information:

 

CALLPIPE, CONSOLE, IN
 

History of change

 

Version

Action

Description

 

 

 

1.1

Added

Support for two output streams; OUT 0 and OUT 1, where OUT 0 corresponds to the primary output stream of the CALLPIPE stage of the calling pipeline and OUT 1 corresponds to the secondary output stream of the CALLPIPE stage of the calling pipeline.

1.2

Changed

OUT writes output records to the CALLPIPE stage command of the calling pipeline (through a shared file segment) or to its STDOUT stream or STDERR stream.