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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>NetView</strong> Pipeline Filters<br />

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

5. CORRWAIT is also terminated, because of the termination of TAKE. There<strong>for</strong>e,<br />

messages from the display command are no longer read into the pipeline.<br />

6. The CONSOLE stage reads the messages and displays them.<br />

Example 2: Keeping the Last two Messages in the Pipeline<br />

This example shows how to use the TAKE stage to select the last two messages<br />

resulting from a command. This is similar to the previous example; however, the<br />

MLWTO has been split into single-line messages using the SEPARATE command<br />

and the TAKE command is selecting the last messages rather than the first:<br />

PIPE NETVIEW D NET,CDRMS | CORRWAIT 60 | SEPARATE | TAKE LAST 2<br />

| CONSOLE<br />

Output from the pipeline looks similar to:<br />

NCCF NETVIEW CNM01 OPER5 03/20/10 12:00:10<br />

* CNM01 PIPE NETVIEW D NET,CDRMS | CORRWAIT 60 | SEPARATE | TAKE LAST 2 |<br />

CONSOLE<br />

’ CNM01 IST482I B20M NEVAC, SA N/A, EL N/A, NETID = NETD<br />

’ CNM01 IST314I END<br />

Processing steps:<br />

1. The NETVIEW stage executes the DISPLAY command and writes messages to<br />

the output stream.<br />

2. The CORRWAIT stage allows a 60 second wait <strong>for</strong> each message to be returned<br />

from VTAM. When the CORRWAIT timer expires, further messages generated<br />

by the NETVIEW stage are not accepted into the pipeline.<br />

3. Be<strong>for</strong>e the 60 seconds expire, the message DISPLAY ACCEPTED arrives in the<br />

input stream, is read by SEPARATE, and passed as is to the output stream.<br />

The timer is reset.<br />

4. Again, be<strong>for</strong>e the 60 seconds expire, the MLWTO is passed to SEPARATE and<br />

because it is an MLWTO, it is split into single-lines, then passed to the output<br />

stream.<br />

5. The stream is passed to TAKE, which selects the last 2 messages and discards<br />

the others.<br />

6. CORRWAIT waits the full 60 seconds, because TAKE LAST is not considered a<br />

terminating stage condition.<br />

7. The CONSOLE stage reads the messages and displays them.<br />

Discarding the First or Last n Messages: DROP<br />

Example: Discarding the First Two Messages<br />

This example shows how to use the DROP stage to discard the first two messages<br />

output from a command. The example shown contains a REXX command list<br />

named DROP2:<br />

/* REXX COMMAND LIST - DROP2 */<br />

’PIPE NETVIEW MAJNODES’, /* ISSUE COMMAND */<br />

’| CORRWAIT 10’, /* WAIT 10 SECONDS */<br />

’| DROP FIRST 2’, /* DROP FIRST 2 MSGS. */<br />

’| CONSOLE’ /* DISPLAY PIPE CONTENTS */<br />

SAY ’RETURN CODE IS’ RC<br />

EXIT<br />

/* DISPLAY RETURN CODE */<br />

Output from DROP2 looks similar to:

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

Saved successfully!

Ooh no, something went wrong!