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

Per<strong>for</strong>ming a Query with SQL SELECT<br />

The argument specifies a complete SELECT statement. One record is written <strong>for</strong><br />

each row of the result of the query. By default, each column is preceded by a<br />

2-byte indicator word specifying whether the column has a null value or contains<br />

data. Use NOINDICATORS to suppress this field in the output record.<br />

In an indicator word, binary zero indicates that the column has a value; a negative<br />

indicator word indicates that the column is null. A positive value in the indicator<br />

word means that the column is truncated; this cannot occur, because each column<br />

has as many positions reserved as SQL DESCRIBE reports <strong>for</strong> the table. Blanks or<br />

zeros, as appropriate to the field <strong>for</strong>mat, are stored in the unfilled positions of<br />

columns that contain a null value and columns that have variable length. When the<br />

last field has variable length, the record is truncated to the end of the data present.<br />

/* Query a table, save results in a stem variable */<br />

’pipe SQL select * from jtest |$stem results.’<br />

’pipe $stem results. | cons’<br />

The above example shows how $STEM saves the message colors in the "results."<br />

array as well as saving the data.<br />

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

color-coded green. Output data is written using <strong>NetView</strong> message type double<br />

quotation mark (HDRTYPEK).<br />

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

written there. 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 instead. Error<br />

messages are also color-coded in red. Error messages are written with the <strong>NetView</strong><br />

message type apostrophe (HDRTYPEJ).<br />

If the third output stream is defined and connected, additional return code<br />

in<strong>for</strong>mation is provided. The output consists of the following items:<br />

v A plus (+) sign or minus (−) sign<br />

v A 10-digit decimal SQL value, including leading zeros<br />

v A blank space<br />

v The input text of the SQL statement that ran.<br />

This stream is useful <strong>for</strong> monitoring end of file conditions, reported by SQLCODE<br />

+0000000100. The stream is color-coded in green and the <strong>NetView</strong> message type is<br />

double quotation mark (HDRTYPEK).<br />

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

yellow, and are written to the secondary stream. Diagnostic messages are written<br />

with the <strong>NetView</strong> message type apostrophe (HDRTYPEJ).<br />

Per<strong>for</strong>ming a Query with DESCRIBE SELECT<br />

The argument is a query to be described. One record is written <strong>for</strong> each field of the<br />

query. See the description of the SQLDA in your DB2 documentation <strong>for</strong> more<br />

in<strong>for</strong>mation.<br />

Each record has five blank-delimited fields of fixed length:<br />

3 The decimal number defining the field type.<br />

16 The field type is decoded or Unknown if the field type is not recognized by<br />

<strong>NetView</strong> SQL Stages. The first four positions have the word LONG if the<br />

field is a long character or graphics field.<br />

Chapter 2. Pipeline Stages and Syntax 221

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

Saved successfully!

Ooh no, something went wrong!