OUT stage v1.3

Pipelines v2.1

 

Purpose, Operands, Streams, Usage, Examples, Related

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

 

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

 

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

 

1.

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.

 

mypipe.rex
 
   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe in | change /ifdef/ /ifndef/ | out'
 4
 5 Exit 0
   **** End of file ****

 

2.

3.

 

Related

 

CALLPIPE, CONSOLE, IN
 

History

 

Version

 

Date

Action

Description

Pipelines

1.3

27.12.2021

changed

Application-wide rewrite.

2.1

1.2

04.02.2012

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.

2.0

1.1

23.05.2011

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.9

1.0

06.09.2007

created

First version.

1.0