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

Examples<br />

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

-1 Is interpreted by pipeline processing as an error in a previous procedure.<br />

For example, an error in a command list called from a NETVIEW stage.<br />

-5 Is interpreted by pipeline processing as a RESET request.<br />

Also, any <strong>NetView</strong> documented return code that might be construed as an error in<br />

pipeline initiation must not be used with PIPEND.<br />

Example: Ending a Pipeline with a Return Code<br />

The pipe in the following example ends with two different return codes depending<br />

on whether the WAIT times out.<br />

If you pass the command LIST STATUS=DSILOG as the first parameter to this REXX<br />

example and the log is not busy, the LIST request easily completes within 2<br />

seconds and the rc returned from the PIPE command is zero. In this case, the<br />

example returns Message was with the result of the LIST STATUS=DSILOG command.<br />

If DSILOG is busy with traffic and the LIST command is delayed by more than 2<br />

seconds, the example times out, rc is set to 8, and Pipe failed with 8 is displayed<br />

on the console.<br />

/* REXX example of ending a pipeline with a return code */<br />

’PIPE (NAME SETRC END¬),<br />

’| NETVIEW’ arg(1), /* do user’s command */<br />

’| ATEND: WAIT 2’, /* fail command if not returned in 2 secs*/<br />

’| VAR ansmsg’, /* keep answer, if any */<br />

’¬ ATEND:’, /* end pipe and connector to wait */<br />

’| CONSOLE’ /* display message from CORRWAIT */<br />

’| PIPEND *’<br />

IF rc = 0 THEN<br />

say ’Message was ’ ansmsg<br />

ELSE<br />

say ’Pipe failed with ’ rc<br />

If in this same REXX example MVSDTis passed as an argument, the pipeline<br />

always timeout and rc always sets to 8. Although this is a simple command which<br />

completes in 2 seconds or less, MVS and VTAM commands do not in<strong>for</strong>m a<br />

pipeline when they complete. Because of this, <strong>NetView</strong> pipelines cannot determine<br />

when these commands end.<br />

To prevent a timeout when using VTAM and MVS commands, add a TAKE or<br />

T<strong>OS</strong>TRING stage immediately following the WAIT stage. For example, if you add<br />

TAKE 1, PIPEND receives a message only if a timeout occurs. Otherwise, PIPEND<br />

does not receive a message and the return code is zero.

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

Saved successfully!

Ooh no, something went wrong!