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

Examples<br />

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

Example: Discover TSO Stacks Serving a User<br />

In the following example, the TSO stacks serving a TCP user are listed:<br />

/* REXX Example usage of TSO stage. */<br />

/* Purpose: to discover which of several TCP stacks is */<br />

/* serving a given user. */<br />

/* */<br />

/* Input: TCP User ID */<br />

/* */<br />

/* Output: stack name and current state */<br />

/* (multiple lines are shown <strong>for</strong> user ids using */<br />

/* multiple ports) */<br />

/* */<br />

/* Assumptions: */<br />

/* 1. the TCP stack name or other mnemonic used */<br />

/* as a member name (copy of CNMSJTSO) <strong>for</strong> */<br />

/* the TSO servers. See help <strong>for</strong> START TS<strong>OS</strong>ERV.*/<br />

/* */<br />

/* 2. authority has been granted to use any server*/<br />

/* found. (Otherwise, further filtering can */<br />

/* be done. See note 1, below.) */<br />

/* */<br />

/* 3. TSO server has PROFILE MSGID in effect. */<br />

/* ---------------------------------------------------- */<br />

ADDRESS NETVASIS<br />

arg theUser<br />

IF words(theUser) 1 THEN<br />

DO;<br />

say ’User ID requried’<br />

EXIT 12<br />

END;<br />

ELSE theUser = left(theUser,8)<br />

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

’| NETV LIST STATUS=TS<strong>OS</strong>ERV’, /* Obtain list of all servers. */<br />

’| SEPARATE DATA’, /* sep & discard label lines.<br />

*/<br />

’| SORT 21.8’, /* sort on member (= stack name).*/<br />

, /* LOCATE? See NOTE 1, below */<br />

’| DELDUPES KEEPFIRST 21.8’, /* keep one of each. */<br />

’| EDIT WORD 2 NEXT’, /* build record: tso userid and */<br />

’WORD 3 NEXTWORD’, /* member name from each line. */<br />

’| STEM STACKS.’ /* save these to feed TSO stage */<br />

/* on its secondary input, below.*/<br />

’PIPE (NAME MULTSTAT END %)’,<br />

’| LITERAL /NETSTAT/’, /* creating a command */<br />

’| DUP *’, /* make copiesindefinitely: NOTE2*/<br />

’| A: TSO’, /* read destinations from A below*/<br />

’| WAIT 90’, /* wait plenty */<br />

’| SEPARATE’, /* can’t use SEP DATA */<br />

’| LOCATE 1.10 /EZA0185I/’, /* get just the data lines */<br />

’| LOCATE 10.10 /’theUser’/’, /* and lines with our user’s name*/<br />

, /* Now that we have data about our user*/<br />

, /* where did it come from? The answer */<br />

, /* is in the attributes: JOBID */<br />

’| EDIT JOBID 1 ’, /* Build msg with member name, */<br />

’word 2 NW ’, /* user’s name, and */<br />

’word 6 NW ’, /* current state. */<br />

’| CONS’, /* */<br />

’| TAKE LAST 1’, /* IS there a last one? */<br />

’| PIPEND 2’, /* IF so, make rc = 2 */<br />

, /* ------ end of main pipeline ------ */<br />

’% STEM STACKS.’, /* first stage: read server list */<br />

’| A:’ /* feed this to TSO secondary */

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

Saved successfully!

Ooh no, something went wrong!