28.11.2012 Views

IBM Tivoli NetView for z/OS Programming: Pipes - IBM notice

IBM Tivoli NetView for z/OS Programming: Pipes - IBM notice

IBM Tivoli NetView for z/OS Programming: Pipes - IBM notice

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introduction and Concepts<br />

8 <strong>Programming</strong>: <strong>Pipes</strong><br />

PIPE (END %)<br />

< NAMES<br />

| A: LOCATE /BOB/<br />

| CHANGE //HERE IS A NAME CONTAINING ’BOB’ ==>/<br />

| CONSOLE<br />

%A:<br />

| CONSOLE<br />

The < (From Disk) stage reads data from a file called NAMES, containing three<br />

names. The three names are:<br />

v BOB SMITH<br />

v FRED FORD<br />

v MARY BOBBIT<br />

The selected data is written to the console using the CONSOLE stage. All records<br />

containing the string BOB will be prefixed with the string HERE IS A NAME<br />

CONTAINING ’BOB’ ==>.<br />

In this example, the string BOB is located in the input data. Label A: was defined on<br />

the LOCATE stage; data that does not contain the string BOB will be passed as an<br />

input stream to the stage following the stage labeled A:. The end of the simple<br />

pipeline and the beginning of the second is indicated by the end character, which<br />

is defined as a % symbol in (END %).<br />

This complex pipeline is logically made up of the following parts:<br />

v The definition of the end character that is to be used to separate the different<br />

simple pipelines.<br />

PIPE (END %)<br />

v The first simple pipeline. The LOCATE stage, which generates multiple output<br />

streams, is labeled with an A: indicating that data not selected by the LOCATE<br />

stage will be passed to the connector A: later in the pipeline specification.<br />

< NAMES<br />

| A: LOCATE /BOB/<br />

| CHANGE //HERE IS A NAME CONTAINING ’BOB’ ==>/<br />

| CONSOLE<br />

v The end character indicates the end of the first simple pipeline and the<br />

beginning of the second simple pipeline.<br />

%<br />

v The next occurrence of label A: is as a connector that connects the secondary<br />

output of LOCATE /BOB/ as an input stream to CONSOLE in the second simple<br />

pipeline. This A: is a connector and not a label definition because this A: is not<br />

included in a stage.<br />

A:<br />

v The second simple pipeline that will handle the data not selected by LOCATE<br />

/BOB/.<br />

| CONSOLE<br />

The resulting output of this complex pipeline is shown in Figure 10 on page 9.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!