CONSOLE stage v1.2

Pipelines v1.9

 

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

Home

 

Syntax

 
>>__CONSole__ ____________ __ _______________________ _________________________________><
             |_EOF_string_|  |_DELIMpair_char1,char2_|
               (1)             (2)
 
Notes:
(1) May only be specified when console is the first stage of the first pipeline.
(2) May only be specified when console is not the first stage of a pipeline.
 

Purpose

 

Use the CONSOLE stage to read lines from the keyboard or write lines to the console.

 

When CONSOLE is the first stage of the first pipeline; CONSOLE reads records from the keyboard and writes them to its primary output stream. CONSOLE stops reading if its primary output stream becomes disconnected. If no operands are specified, CONSOLE stops reading when a null line is entered from the keyboard. To enter a null line, press <enter> without typing anything on the command-line.

 

When CONSOLE is not the first stage of a pipeline; CONSOLE reads records from its primary input stream and writes them to the console and to its primary output stream, if it is connected. CONSOLE appends a Line-Feed character to each output record that it writes to the console, primary output stream records are written unchanged.

 

Operands

 

    

EOF

specifies that CONSOLE is to stop reading from the keyboard when the input text matches string.

 

 

string

is a string that you want CONSOLE to recognise as a signal to stop reading from the keyboard. The string is not written to the output stream. Uppercase and lowercase representations of the same characters do not match. CONSOLE stops reading from the keyboard if the line read matches the target string you specify.

 

    

DELIMpair

specifies that records written to the console are prefixed and appended with a pair of delimiting characters. The CONSOLE stage only uses the delimiting characters when writing the record to the console, they are not included in the record written to the primary output stream.

 

 

char1

char2

are a pair of characters that will surround the record displayed on the console.

 

For example: to display a record surrounded by a leading > and trailing <:

 

. . . console delimpair >,< . . .
 

Streams used

 

The following streams are used by the CONSOLE stage:

 

Stream

Action

 

 

Primary input stream

When CONSOLE is not the first stage of the pipeline, CONSOLE reads records from its primary input stream.

Primary output stream

When CONSOLE is the first stage of the first pipeline, CONSOLE writes the records it reads from the keyboard to its primary output stream. When CONSOLE is not the first stage of the pipeline, CONSOLE writes the records it reads from its primary input stream to its primary output stream.

 

Usage notes

 

     1)

CONSOLE does not delay the records.

 

     2)

When CONSOLE is the first stage of the first pipeline and it discovers that its primary output stream is not connected, the CONSOLE stage ends.

 

     3)

CONSOLE may stop reading from the keyboard before the condition specified in the operands is satisfied. If a stage that reads records which flow out of the CONSOLE stage, ends or disconnects its input stream, the CONSOLE stage ends; as in the following example: The first CONSOLE stage stops reading from the keyboard after the second line of data or a null has been entered. (The TAKE stage reads exactly 2 records and then disconnects is primary input stream; causing the primary output stream of the CONSOLE stage to become disconnected; which terminates the stage).

 

C:\>pipe “console | take 2 | console”

 

     4)

When the pipe TRACE ON option is specified (or the pipeline has inherited the TRACE ON setting through the CALLPIPE stage command); the CONSOLE stage encloses it’s console output in angle brackets – prefixed with the CONSOLE stage name. For example:

 

CONSOLE: >some output text<

 

However; the CONSOLE stage only uses this output format when writing a record to the console; records that are written to the primary output stream are written without modification.

 

     5)

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

 

Examples

 
None.
 

See also

 

Reference the following links for additional information:

 
IN, OUT