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.

Examples<br />

v Line count attributes set by EACHLINE are preserved, when calling a command<br />

with a message providing the target command, contains no processing that alters<br />

the current message.<br />

v Message count attributes set by EACHMSG are not preserved when calling a<br />

command with the message.<br />

Example: Counting Messages<br />

The following example counts the number of messages copied by ASSIGN to the<br />

operators listed in the OPS. stem. REXX resolves the value <strong>for</strong> total in the PIPE <strong>for</strong><br />

each iteration of the DO loop. The PIPE then adds the count of the next operator's<br />

assigned messages to total. After the messages <strong>for</strong> all operators in OPS. stem are<br />

counted, the total count <strong>for</strong> all operators is returned in the SAY statement.<br />

/* REXX Fragment */<br />

...<br />

total = 0;<br />

DOdex=1TOOPS.0<br />

’PIPE NETV LIST ASSIGN=COPY OP=’||OPS.dex,<br />

’| LOCATE 1.7 /DSI637I/’,<br />

’| COUNT LINES FROM’ total,<br />

’| VAR total’<br />

END<br />

SAY ’There are’ total ’messages copied to the operators.’<br />

...<br />

Example: Line Counts Reset by Command<br />

The line count values set by COUNT EACHLINE can be reset by a command.<br />

Consider the following REXX CLIST:<br />

/* REXX Example - Echo safe to console */<br />

’PIPE SAFE *’,<br />

’ | CONSOLE’<br />

EXIT<br />

Now, if we name this CLIST ECHO and we call ECHO from the following<br />

pipeline, the line count attributes are preserved.<br />

PIPE < INFILE<br />

|COUNT EACHLINE<br />

|NETVIEW /AUTO1: ECHO<br />

|WAIT 10<br />

|SAFE KEEPER<br />

In this example a series of lines are read from INFILE. Each line is counted and the<br />

line attributes added to the lines be<strong>for</strong>e they are passed to ECHO. ECHO reads the<br />

current line passed from the PIPE through the SAFE stage and writes it as output<br />

in this correlated environment. The line returns from ECHO to the above pipe<br />

which is waiting <strong>for</strong> 10 seconds <strong>for</strong> the return from ECHO. The unchanged line is<br />

stored in the SAFE named KEEPER.<br />

Now, if ECHO was changed as follows:<br />

/* REXX Example - Echo safe to console */<br />

’PIPE SAFE *’,<br />

’ | COUNT EACHLINE’,<br />

’ | CONSOLE’<br />

EXIT<br />

PIPE COUNT<br />

Chapter 2. Pipeline Stages and Syntax 61

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

Saved successfully!

Ooh no, something went wrong!