DUPLICATE
v1.1
v2.1

Purpose | Argument | Streams | Usage | Examples | Related

Syntax

               ┌─1──────┐
>>──DUPlicate──┼────────┼────────────────────────────────────────────────────────────><
               ├─copies─┤
               ├─ALL────┤
               ├─*──────┤
               └─ -1 ───┘
Purpose

Use the DUPLICATE stage to write each input record in addition to the specified number of copies of each input record. DUPLICATE reads records from its primary input stream and writes records to its primary output stream, if it is connected. It does not discard null input records.

Argument
Streams

Stream
Action
Primary input
DUPLICATE reads records from its primary input stream.
Primary output
DUPLICATE writes to its primary output stream the original record plus the specified number of copies of each record read from its input stream.

Usage
  1. DUPLICATE does not delay the records.

  2. If the DUPLICATE stage discovers that its primary output stream is not connected, the DUPLICATE stage ends.

  3. DUPLICATE verifies that its secondary input and output streams are not connected and then begins execution.
Examples
  1. The following pipeline reads the input file: input.txt, and creates an output file: output.txt, that contains five additional copies of each input record. (The resulting output file will contain six records: the original record plus five copies.)

    input.txt (input)
    ...|...+....1....+....2....+....3....+....4.... **** Top of file **** 1 Name........... Address................. **** End of file ****

    'pipe < input.txt | duplicate 5 | > output.txt'
    

    output.txt (output)
    ...|...+....1....+....2....+....3....+....4.... **** Top of file **** 1 Name........... Address................. 2 Name........... Address................. 3 Name........... Address................. 4 Name........... Address................. 5 Name........... Address................. 6 Name........... Address................. **** End of file ****

  2. In this example, there are two input records to duplicate and each is duplicated once (the default value for copies).

    address rxpipe
    'pipe literal /Your boat/', '| literal /Row/', '| duplicate', '| console'
    exit rc

    console:
    Row Row Your boat Your boat

    Note. that Row is displayed before Your boat, in reverse order of the LITERAL stages in the pipeline.

Related

BUFFER

History

Version
Date
Action
Description
Pipelines
1.1
??.??.????
changed
Application-wide rewrite.
2.1
1.0
06.09.2007
created
First version.
1.0