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

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

v The SSIDssidname option is supported.<br />

Working with Graphic Character Strings (DBCS)<br />

The SQL stage and the SQSELECT procedure can process graphic (DBCS) fields.<br />

v When issuing an SQL INSERT, the shift-in and shift-out characters must be<br />

included in the data in the VALUES clause.<br />

v When doing an SQL SELECT, the shift-in and shift-out characters are not<br />

returned by SQL.<br />

v The SQSELECT procedure inserts the shift-in and shift-out characters as part of<br />

the output fields so that values are properly displayed.<br />

v The field sizes <strong>for</strong> graphic characters are counted by DB2 as the number of<br />

DBCS characters, and the amount of space the field uses is 2 * (number of DBCS<br />

characters) bytes.<br />

v A SQL DESCRIBE SELECT request displays the number of DBCS characters in<br />

the Field Length column. The number in the Maximum Field Length column is<br />

the number of bytes in the record <strong>for</strong> the field. This is twice the number of<br />

DBCS characters plus two bytes if the field has varying length. The shift-in and<br />

shift-out characters are counted in the maximum field length (but they take up<br />

space in the external data <strong>for</strong>mat.)<br />

SQSELECT uses a column width equal to the maximum number of bytes the<br />

data required (excluding the 2-byte varying length) plus 2 bytes <strong>for</strong> the shift-in<br />

and shift-out characters.<br />

Defining the Unit of Work<br />

DB2 commits changes to the database at the end of the unit of work. The unit of<br />

work ends with an explicit COMMIT or by reaching the end of the pipe. Unless<br />

instructed by an option, SQL per<strong>for</strong>ms an explicit commit and closes the plan<br />

when processing is complete. Use the option COMMIT when you want the unit of<br />

work to be committed without closing the plan. Use NOCOMMIT in concurrent<br />

SQL stages, and to treat a subsequent SQL stage as the same unit of work.<br />

The unit of work can also be rolled back. That is, the database is restored to the<br />

state be<strong>for</strong>e the unit of work began. SQL automatically rolls the unit of work back<br />

when it receives an error code from DB2; use SQL ROLLBACK WORK to per<strong>for</strong>m<br />

an explicit rollback, possibly, in response to a pipeline error condition.<br />

Use NOCL<strong>OS</strong>E to leave the plan open from one pipe to another on the same <strong>Tivoli</strong><br />

<strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> task. Because the close of the plan takes place when all<br />

concurrent SQL stages have terminated, a NOCL<strong>OS</strong>E option used in any<br />

concurrent stage of a pipe keeps the plan open when the pipe ends. If you use<br />

NOCL<strong>OS</strong>E, a subsequent SQL stage can fail if it tries to change the subsystem<br />

name, which is the SSID ssidname parameter on the SQL stage. DB2 enables only<br />

one subsystem at a time per task.<br />

The plan closes when none of the SQL stages specify NOCL<strong>OS</strong>E. If even one SQL<br />

stage specifies NOCL<strong>OS</strong>E, the plan remains open.<br />

PIPE SQL COMMIT WORK | CONS<br />

The previous example is an example of committing the unit of work and closing<br />

the active plan.<br />

Note: If a plan is left open and the REXX procedure ends, the plan remains open<br />

until a subsequent pipe closes it or the task ends. A REXX procedure might

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

Saved successfully!

Ooh no, something went wrong!