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.

Using <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL Stages <strong>for</strong> Access to DB2<br />

use PIPE SQL COMMIT WORK | CONS at the start of SQL processing to ensure<br />

that any previous plan is closed. Alternatively, a PIPE SQL NOCL<strong>OS</strong>E CONNECT<br />

RESET | CONS can be used to ensure that the local database is being used<br />

and the plan is open.<br />

The following are reasons to use NOCL<strong>OS</strong>E:<br />

v When using SQL CONNECT to connect a remote database, a NOCL<strong>OS</strong>E enables<br />

you to keep the remote connection between two pipes. You might find it<br />

convenient to open a remote connection in one pipe, do some processing in<br />

REXX, and finish working with the remote connection in a second pipe. Specify<br />

NOCL<strong>OS</strong>E in the first pipe and omit the operand everywhere in the second<br />

pipe.<br />

v When using database locks in SQL, use NOCL<strong>OS</strong>E to keep the locks from one<br />

PIPE to the next.<br />

v Other applications requiring two pipes to implement one function, typically,<br />

with other (REXX) processing between the two pipes.<br />

Using Secondary Output Streams with SQL<br />

SQL EXECUTE processes multiple I/O requests from the primary input stream that<br />

has multiple insert, or query statements, or a mixture of these.<br />

The results of the queries are written to the primary output stream, and have the<br />

color attribute green (CG). Output data is written using <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong><br />

message type double quotation mark (HDRTYPEK).<br />

If the secondary output stream is defined and connected, any error messages are<br />

written to it. If a secondary stream is not defined, error output is not sent to the<br />

primary stream, but escapes to the parent pipe or is displayed. Error messages also<br />

have the color attribute red (CR). Error messages are written with the <strong>Tivoli</strong><br />

<strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> message type apostrophe (HDRTYPEJ).<br />

Diagnostic messages (from the SQL TEST or DIAGN<strong>OS</strong>E options) are color-coded<br />

yellow (CY) and are written to the secondary stream. Diagnostic messages are<br />

written with the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> message type apostrophe (HDRTYPEJ).<br />

Using Concurrent SQL Stages<br />

You can process the results of a query to construct DB2 statements and queries<br />

processed in a subsequent SQL stage. As seen from DB2, all concurrent SQL stages<br />

are considered to be the same program using a single cursor.<br />

The option NOCOMMIT must be specified when multiple SQL stages are running<br />

concurrently. Each stage uses its own work areas. Up to 10 SQL stages can be<br />

coded in one PIPE.<br />

If one stage fails with a DB2 error, the unit of work is rolled back. All subsequent<br />

SQL stages in the pipeline ignore all input. Messages indicating the failure are<br />

issued. NOCL<strong>OS</strong>E is respected if coded within the pipeline.<br />

You can process a query and store the result in a REXX stemmed array, test the<br />

return code, and issue the second SQL pipeline only when the first one has<br />

completed satisfactorily.<br />

When accessing DB2 subsystems from a <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> system, you<br />

cannot directly access multiple DB2 subsystems on a single task without having<br />

Chapter 6. Using <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL Stages <strong>for</strong> Access to DB2 339

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

Saved successfully!

Ooh no, something went wrong!