FANOUT stage v1.1

Pipelines v2.1

 

Purpose, Operands, Streams, Usage, Examples, Related

Home

 

Syntax

 

            ┌─STOP ALLeof──────┐
>>──FANOUT──┼──────────────────┼─────────────────────────────────────────────────────><
            └─STOP─ALLeof───┘
                   ─ANYeof──
                   └─streams─┘

 

Purpose

 

Use the FANOUT stage to make a copy of its input stream on every connected output stream. FANOUT reads records from its primary input stream and writes them to multiple output streams in the order: stream 0, stream 1, stream 2 and so on. FANOUT reads one record at a time from its primary input stream and writes the record to each of its connected output streams.

 

Operands

 

STOP

specifies how many output streams must be at end-of-file (disconnected), for FANOUT to stop writing records. STOP ALLEOF is the default.

 

 

ALLeof

specifies that records will stop being written when FANOUT determines that no output stream is connected. Records continue to be written as long as at least one output stream is connected. STOP ALLEOF is the default.

 

ANYeof

specifies that records will stop being written as soon as FANOUT determines that any one of its output streams is no longer connected.

 

streams

is an unsigned integer which defines the number of streams that were originally connected, but are now unconnected causing FANOUT to stop writing records. Specifying 1 is equivalent to specifying ANYEOF.

 

Streams

 

The following streams are used by the FANOUT stage:

 

Stream

 

Action

 

 

Primary input stream

FANOUT reads records from its primary input stream.

Output streams

FANOUT writes its input records to all of its connected output streams, starting with the primary output stream and continuing with the rest of the streams in order of increasing stream number.

 

Usage

 

1.

FANOUT does not delay the records.

 

2.

FANOUT determines the number of streams that are at end-of-file each time it attempts to write to an output stream. When this number is reached; FANOUT ends without writing to the remaining connected output streams.

 

3.

FANOUT verifies that its secondary input stream is not connected and then begins execution.

 

Examples

 

1.

The following pipeline makes two copies of its input record and writes them to separate output files.

 
   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe (endchar ?)',
 4    'literal /First output file/',
 5    '| a: fanout',
 6    '| > output1.txt',
 7    '?',
 8    'a:',
 9    '| change /First/ /Second/',
10    '| > output2.txt'
11
12 Exit 0
   **** End of file ****

 

2.

Locate and mark

3.

Searching for multiple words
 
 
///////////////////////////
 
 

The following exec makes two copies of the input data and processes each one differently:

/* FANOUT EXEC */

'pipe (endchar $)',

  'literal Tennis anyone?'||, /* write literal data for FANOUT */

  '| a: fanout',              /* copy Tennis anyone? to every output */

  '| > TENNIS FILE A',        /* write Tennis anyone? to TENNIS FILE */

  '$',                        /* start of second pipeline */

  'a:',                       /* define secondary output for FANOUT */

  '| change /Tennis/Golf/',   /* change Tennis to Golf */

  '| > GOLF FILE A'           /* write Golf anyone? to GOLF FILE */

Figure 68 and Figure 69 are the output files created by this exec.

Figure 68. FANOUT Stage Example: Output File Contents (TENNIS FILE A)

 TENNIS   FILE     A1  V 80  Trunc=80 Size=1 Line=0 Col=1 Alt=0

 

 

 

 

      |...+....1....+....2....+....3....+....4....+....5....+....6....+....7...

===== * * * Top of File * * *

===== Tennis anyone?

===== * * * End of File * * *

Figure 69. FANOUT Stage Example: Output File Contents (GOLF FILE A)

 GOLF     FILE     A1  V 80  Trunc=80 Size=1 Line=0 Col=1 Alt=0

 

 

 

 

      |...+....1....+....2....+....3....+....4....+....5....+....6....+....7...

===== * * * Top of File * * *

===== Golf anyone?

===== * * * End of File * * *

 
 
 

Related

 

FANIN, FANINANY

 

History

 

Version

 

Date

Action

Description

Pipelines

1.1

24.12.2021

changed

Application-wide rewrite.

2.1

1.0

06.09.2007

created

First version.

1.0