Creating a Complex Pipeline
This section describes the way to create a complex pipeline using stages with multiple inputs and outputs. When stages are adjacent to each other in a pipeline, the output stream of a stage is connected to the input stream of the stage that follows.
...|B: LOCATE /X/|...PIPE (END %)
< NAMES
| A: LOCATE /BOB/
| CHANGE //HERE IS A NAME CONTAINING 'BOB' ==>/
| CONSOLE
%A:
| CONSOLE< (From Disk) stage reads data from a file
called NAMES, containing three names. The three
names are: - BOB SMITH
- FRED FORD
- MARY BOBBIT
The selected data is written to the console using the CONSOLE stage.
All records containing the string BOB will be prefixed
with the string HERE IS A NAME CONTAINING 'BOB' ==>.
In this example, the string BOB is located in
the input data. Label A: was defined on the LOCATE stage;
data that does not contain the string BOB will be
passed as an input stream to the stage following the stage labeled A:.
The end of the simple pipeline and the beginning of the second is
indicated by the end character, which is defined as
a % symbol in (END %).
- The definition of the end character that is to be used to separate
the different simple pipelines.
PIPE (END %) - The first simple pipeline. The
LOCATEstage, which generates multiple output streams, is labeled with anA:indicating that data not selected by theLOCATEstage will be passed to the connectorA:later in the pipeline specification.< NAMES | A: LOCATE /BOB/ | CHANGE //HERE IS A NAME CONTAINING 'BOB' ==>/ | CONSOLE - The end character indicates the end of the first simple pipeline
and the beginning of the second simple pipeline.
% - The next occurrence of label
A:is as a connector that connects the secondary output ofLOCATE /BOB/as an input stream toCONSOLEin the second simple pipeline. ThisA:is a connector and not a label definition because thisA:is not included in a stage.A: - The second simple pipeline that will handle the data not selected
by
LOCATE /BOB/.| CONSOLE
The resulting output of this complex pipeline is shown in Figure 1.
NCCF N E T V I E W CNM19 PETE 03/26/10 13:10:00
* CNM19 PIPE (END %) < NAMES | A: LOCATE /BOB/ | CHANGE //HERE IS
A NAME CONTAINING 'BOB' ==>/| CONSOLE % A: | CONSOLE
| CNM19 HERE IS A NAME CONTAINING 'BOB' ==>BOB SMITH
| CNM19 FRED FORD
| CNM19 HERE IS A NAME CONTAINING 'BOB' ==>MARY BOBBIT
- You can have as many simple pipelines within a complex pipeline specification as you need. Each stage with multiple outputs can pass data to different connectors. Or, multiple stages can pass data to a single connector.
- Each pipeline stream acts as independently as possible. For example,
in Figure 1, the
record
FRED FORDis processed in the second simple pipeline,A:, while the first simple pipeline is still processing the records selected byLOCATE /BOB/. - If a connector immediately follows an end character, then it defines an output stream to the stage where the label is defined. If an end character, or the end of the pipeline specification, immediately follows a connector, the connector defines input to the stage where the label was defined. Otherwise, the connector defines both an input and output stream to the stage where the label was defined.