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 />

Stage Input and Output<br />

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

Note: In portrait <strong>for</strong>m you must include the appropriate continuation character <strong>for</strong><br />

the programming language after each line except the last.<br />

For readability, most examples in this book are shown in portrait <strong>for</strong>m.<br />

PIPE STAGE1<br />

| STAGE2<br />

| STAGE3<br />

| STAGE4<br />

| STAGE5<br />

| STAGE6<br />

Figure 4. A PIPE Command Coded in Portrait Format<br />

PIPE STAGE1 | STAGE2 | STAGE3 | STAGE4 | STAGE5 | STAGE6<br />

Figure 5. A PIPE Command Coded in Landscape Format<br />

For more in<strong>for</strong>mation, see Chapter 2, “Pipeline Stages and Syntax,” on page 19.<br />

An important concept in the processing of pipelines is the passing of data, or<br />

messages, from one stage to another by data streams or streams. A data stream is<br />

a logical link between one stage and another that provides <strong>for</strong> the transfer of<br />

messages.<br />

The messages entering a stage are passed on its input stream. The messages<br />

leaving a stage are passed on its output stream. In the example in Figure 3 on page<br />

3, LOCATE reads all messages from its input stream, but writes only the messages<br />

containing the string BOB to its output stream.<br />

Figure 6 shows how messages flow through several stages. The output of the<br />

LOCATE stage becomes the input to the TAKE stage.<br />

Bob Smith<br />

Fred Ford<br />

Mary Bobbit<br />

Locate /Bob/<br />

Stage<br />

Fred<br />

Ford<br />

Bit<br />

Bucket<br />

Bob Smith<br />

Mary Bobbit<br />

Figure 6. Messages Flowing through Multiple Stages<br />

Take 1<br />

Stage<br />

Bit<br />

Bucket<br />

Bob Smith<br />

The LOCATE stage reads three messages from its input stream: BOB SMITH, FRED<br />

FORD, and MARY BOBBIT. It writes the messages containing BOB to its output stream.<br />

The TAKE stage reads messages from its input stream. There are only two<br />

messages: BOB SMITH and MARY BOBBIT. TAKE selects the first message and writes a<br />

single message to its output stream.<br />

A stage can have up to ten input and output streams, numbered from 1 to 10. The<br />

first two streams are called the primary stream and the secondary stream. Some<br />

Mary<br />

Bobbit

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

Saved successfully!

Ooh no, something went wrong!