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

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

5 The field length as reported by DB2. This is a single number except <strong>for</strong><br />

decimal fields where the precision and scale are reported with a comma<br />

between them. For graphic fields, the length is the number of DBCS<br />

characters and does not include shift-in or shift-out characters.<br />

5 The maximum length of the field in characters, including a halfword<br />

length field if required, computed from the length and field type. This is<br />

the number of bytes SQL SELECT reserves <strong>for</strong> the field in the output<br />

record from a query, and the number of bytes required in the input record<br />

to SQL INSERT. The length does not include the indicator word. For<br />

graphic fields, the length is the number of bytes of DBCS characters and<br />

does not include shift-in or shift-out characters, but does include 2 bytes<br />

<strong>for</strong> the length field if the field is variable length.<br />

30 The field name. The record is truncated at the end of the name; the name<br />

field is in the range of 1-30bytes.<br />

Sample DESCRIBE SELECT<br />

/* Describe the result of a query */<br />

’pipe SQL describe select * from jtest | console’<br />

Loading Tables with SQL INSERT<br />

An insert statement with a values() clause or a subquery is executed immediately<br />

without reference to an input stream. A values() clause cannot refer to host<br />

variables. Either a values() clause or a subquery must be used. DB2 does not<br />

provide the ability to insert on a cursor.<br />

Release statement, Set Connection, Set Current Degree, Set<br />

Current Package Set, Set Current Rules, or Send Current SQLID<br />

Definitions of parameters match the SQL language. Because these statements<br />

cannot be executed using dynamic SQL, the <strong>NetView</strong> program provides explicit<br />

code support <strong>for</strong> them. These statements can be used in a "PIPE SQL EXECUTE"<br />

on the primary input stream as is done <strong>for</strong> other functions.<br />

Using SQL LISTREGS<br />

This function, which is provided with the <strong>NetView</strong> program, lists the values in the<br />

DB2 special registers. It provides the following output:<br />

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

* NTV98 PIPE SQL SSID DB2 LISTREGS | CONS<br />

" NTV98<br />

CURRENT DEGREE=1<br />

CURRENT PACKAGESET=<br />

CURRENT RULES=DB2<br />

CURRENT SERVER=DB2L01<br />

CURRENT SQLID=<strong>IBM</strong>USER<br />

USER=<strong>IBM</strong>USER<br />

CURRENT TIMEZONE=-50000<br />

CURRENT TIMESTAMP=1998-11-09-09.31.02.048057<br />

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

Using SQL EXECUTE<br />

A statement after EXECUTE is issued first; the primary input stream is then read<br />

and each record is per<strong>for</strong>med. All DB2 statements are per<strong>for</strong>med as a single unit of<br />

work. Most DB2 statements are supported; see the description of the PREPARE<br />

statement in your DB2 documentation <strong>for</strong> a list of unsupported statements. SQL<br />

processes COMMIT, CONNECT, and ROLLBACK directly; thus, they are also<br />

supported. Unsupported statements are rejected by DB2 with return code -515.<br />

Processing stops as soon as an error is reported by DB2.

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

Saved successfully!

Ooh no, something went wrong!