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.

* HALERT: Retrieve Alert History */<br />

’ATTACH NPDA’ /* Output, including messages will be */ ▌1▐<br />

/* saved <strong>for</strong> future VET call */<br />

’PIPE (NAME AHIST1 END +)’, /* Start a pipe */ ▌2▐<br />

’| VET NEXT ROWS’, /* give update when it arrives, as image*/<br />

’| CORRWAIT MOE 60’, /* Wait 60 sec <strong>for</strong> first NPDA screen */<br />

’| NLOCATE 1.7 /BNH150I/’, /* I KNOW what first screen looks like */ ▌3▐<br />

’| CONSOLE’, /* show badness */<br />

’| A: LOCATE 1.7 /DWO369I/’, /* Separate time-out message (MOE) */ ▌4▐<br />

’| VAR timeout’, /* save time-out message */<br />

’+ A:’, /* other message? */ ▌5▐<br />

’| VAR npdamsg’ /* ...save first <strong>for</strong> test */<br />

If symbol(’timeout’) = ’VAR’ THEN /* time out? */<br />

Signal TIMEOUT /* handle unexpected error */<br />

If symbol(’npdamsg’) = ’VAR’ THEN /* some NPDA error */<br />

Exit 20 /* messages from NPDA already shown */<br />

/*----------------- Down to business -----------------------*/<br />

/* Type a ’ALH’ (Alerts History) in the command area and push enter. */<br />

’VET /ALH/’ /* Sending the ’ALH’ and an enter key. */ ▌6▐<br />

Do UNTIL(thispage = lastpage | RC¬=0) ▌7▐<br />

’PIPE (NAME AHISTLP END =)’, /* start a big pipe */<br />

’| VET NEXT ROWS’, /* give update when it arrives, as image*/<br />

’| CORRWAIT MOE 60’, /* Wait 60 sec <strong>for</strong> rnd trip to DST... */<br />

’| SC: LOCATE 1.7 /BNH150I/’,/* expected screen with data.. */ ▌8▐<br />

’| SEPARATE’, /* handle lines individually... */<br />

’| PG: DROP 4’, /* drop header area... */<br />

’| DROP LAST 1’, /* command line */<br />

’| MSG: DROP LAST 4’, /* message area, hopefully blank */<br />

’| STRIP TRAILING’, /* shorten line ending in blank, so we */<br />

’| LOCATE 1 //’, /* can toss out blank lines */<br />

’| CONSOLE’, /* Report data out to user */<br />

’| TAKE 1’, /* AND use ONE new data line to trigger */ ▌9▐<br />

’| NETV VET /FORWARD/’, /* ...new data, then go to next screen */ ▌10▐<br />

’= MSG:’, /* Immed message area from NPDA */<br />

’| LOCATE 2.3 /BNJ/’, /* any error message in immed area */<br />

’| CONSOLE’, /* REPORT it, too. */<br />

’| VAR npdamsg’, /* save <strong>for</strong> test */<br />

’= SC:’, /* message instead ?? This is bad. */<br />

’| A: LOCATE 1.7 /DWO369/’, /* Separate time-out message (MOE) */<br />

’| VAR timeout’, /* save time-out message */<br />

’= A:’, /* other message ? ?? This is bad. */<br />

’| CONSOLE’, /* show badness */<br />

’| VAR npdamsg’, /* ...save first <strong>for</strong> test */<br />

’= PG:’, /* get header area */<br />

’| DROP 2’, /* drop BNH150 and NPDA head-date line */<br />

’| VAR pagedata’ /* ...save pagedata <strong>for</strong> test */<br />

If symbol(’timeout’) = ’VAR’ THEN /* time out? is possible? */<br />

Signal TIMEOUT /* handle unexpected error */<br />

Parse var pagedata . ’PAGE’ thispage . lastpage /* parse out page nos. */<br />

End /* */<br />

EXIT 0 /* And do automatic DETACH <strong>for</strong> NPDA’s V<strong>OS</strong>T */<br />

Figure 24. Sample Full-Screen Automation Program — Capture Alert History<br />

Full-Screen Automation<br />

Within this example there are a number of important things to note:<br />

▌1▐ The ATTACH command creates a V<strong>OS</strong>T and starts NPDA <strong>for</strong> automation.<br />

Full-screen applications can be automated only if started with ATTACH.<br />

▌2▐ The PIPE AHIST1 waits <strong>for</strong> a response from NPDA using VET NEXT and<br />

CORRWAIT. This pipeline ends normally when NPDA is ready to receive<br />

input.<br />

▌3▐ If BNH150I is returned, the NPDA main menu was successfully displayed,<br />

Chapter 5. Full-Screen Automation 331

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

Saved successfully!

Ooh no, something went wrong!