BUFFER stage v1.1

Pipelines v1.9

 

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

Home

 

Syntax

 
>>__BUFFER__ _________ __ _________________ ___________________________________________><
            |_REVerse_|  |_sets_ ________ _|
                                |_string_|

 

Purpose

 

Use the BUFFER stage without operands to accumulate all the records (including null records) from its primary input stream, not passing any of the records until end-of-file is reached on the primary input stream. When BUFFER reaches end-of-file on its primary input stream, it writes all the records to its primary output stream.

 

Use the BUFFER stage with an operand to accumulate input records until a null record is read or end-of-file is reached. BUFFER writes this set of input records the specified number of times. If you specify a number greater than one, a null record or a record containing the specified string is written between the copies of the set of input records. Then BUFFER copies the null input record or the specified string to its primary output stream. This process continues until BUFFER reaches end-of-file on its primary input stream and all sets of input records have been written.

 

Operands

 

    

REVerse

specifies that the accumulated set of records is written to the primary output stream in reverse record order. That is to say; the last record in the buffer is written to the primary output stream first, followed by last-1, last-2 and so on, ending a set of output records with the first record in the buffer.

 

    

sets

is an unsigned integer which specifies the number of copies of the set of input records that are written to the primary output stream. If you do not specify sets, one copy of the set of input records is written to the primary output stream. If you specify sets without specifying string, BUFFER writes a null record between copies of the set of output records.

 

    

string

is a string to write between each set of input records.

 

Streams used

 

The following streams are used by the BUFFER stage:

 

Stream

Action

 

 

Primary input stream

BUFFER reads records from its primary input stream.

Primary output stream

After reading all its input records or a null input record, BUFFER copies the records to its primary output stream.

 

Usage notes

 

     1)

If no operands are specified, BUFFER delays the records until end-of-file is reached. If one or more operands are specified, BUFFER delays the records until the end of a set of input records is reached.

 

     2)

If you use the same input streams, identical output streams are produced by the following two buffer stages:

 

. . . | buffer | . . .

 
. . . | buffer 1 | . . .
 

The timing of the output records is different if there are null records in the input stream. When used without operands, BUFFER reads all input records before writing output records. When used with operands, BUFFER produces its first output record after it reads the first null record.

 

     3)

A BUFFER stage can be used to prevent a pipeline from stalling. See: pipeline stalls for an explanation.

 

     4)

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

 

Examples

 

Buffering records

 

See also

 

Reference the following links for additional information:

 

DUPLICATE, ELASTIC, SORT