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.

PIPE KEEP<br />

Examples<br />

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

The command is invoked with the same authority as the pipe command<br />

that specified the command string. Be careful when composing the<br />

command because neither authority nor syntax is checked until the time of<br />

invocation.<br />

Example: Accumulating Data<br />

In the following examples, data is accumulated about a resource prior to an action:<br />

IF MSGID=’IST950I’ & TEXT = . ’NCP44’ . THEN<br />

EXEC(CMD(’PIPE SAFE * | KEEP NCP44 600 APPEND’))<br />

ROUTE(ONE NETOP1);<br />

* Keep messages until no message has been received<br />

<strong>for</strong> ten minutes<br />

* Note that all references to keep NCP44 must be<br />

invoked on the same opid<br />

IF MSGID=’IST6778A’ & TEXT = . ’NCP44’ . THEN<br />

EXEC(CMD(’CHKNCP NCP44’));<br />

* Another message causes us to examine the history...<br />

Where CHKNCP begins as follows:<br />

/* CHKNCP REXX */<br />

parse arg keepName /* Keep names are case sensitive */<br />

’PIPE (NAME CHKNCP1)’,<br />

’| KEEP’ keepName ’SEIZE’, /* empty, not copy, the Keep */<br />

’| TAKE LAST 2’, /* to examine PART of the history */<br />

’| EDIT IFRAUGMT OPDT 1’, /* we need times of the two events*/<br />

’| STEM timeOfEvents.’<br />

... examine times in stem var<br />

Example: Operator Logoff Actions<br />

In a user-written REXX procedure, you can use<br />

’PIPE SAFE * | EDIT MSGSENDER | VAR targetOP’<br />

to determine the source of the current message.<br />

/* Use AUTO1 to take action related to other tasks logging off */<br />

’PIPE (NAME SETLOGOF)’<br />

’| LITERAL /any text here/’,<br />

’| KEEP LOGOFF * ENDCMD /EXCMD AUTO1, myRexx/’<br />

Example: Using Global Keep<br />

To use a global keep, you can use<br />

IF MSGID=’IST950I’ & TEXT = . ’NCP44’ . THEN<br />

EXEC(CMD(’PIPE SAFE * | KEEP GLOBAL /NCP44/ 600 APPEND’))<br />

ROUTE(ONE NETOP1);<br />

Note that references to KEEP GLOBAL /NCP44/ do not need to be invoked on the<br />

same opid<br />

IF "MSGID’’IST6778A & TEXT=.’NCP44’ THEN<br />

EXEC(CMD(’CHKNCP NCP44’));<br />

Where CHKNCP begins as follows:<br />

/* CHKNCP REXX */<br />

parse arg keepName /* Keep names are case sensitive */<br />

’PIPE (NAME CHKNCP1)’,<br />

’| KEEP’ GLOBAL keepName ’SEIZE’, /* empty, not copy, the Keep */

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

Saved successfully!

Ooh no, something went wrong!