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.

column is null or contains data. This in<strong>for</strong>mation might be required to process the<br />

result of a table query containing columns that can have the null value (no data).<br />

The following example shows how indicator words are suppressed in the output<br />

record; the query seen by DB2 is the same in both the preceding and the following<br />

examples. The remaining two unprintable bytes contain the length, in binary, of the<br />

varying field. Use EDIT to discard these columns.<br />

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

CCC ""TIVOLI NETVIEW FOR <strong>OS</strong>/390 AUTOMATION<br />

BBB ""NETWORK PROGRAM<br />

AAA ""AUTOMATED BANKING SYSTEM<br />

As an alternative to the previous method, the following example shows how to use<br />

EDIT to <strong>for</strong>mat binary data:<br />

/* Query the test table without <strong>for</strong>matting */<br />

Signal on novalue<br />

’PIPE’,<br />

’SQL noindicators select * from jtest ’,<br />

’|SEPARATE’,<br />

’|EDIT 1.3 1 9.2 c2d substr 2.* right 2511.*8’,<br />

’|console’<br />

Exit RC<br />

CCC 36 TIVOLI NETVIEW FOR <strong>OS</strong>/390 AUTOMATION<br />

BBB 15 NETWORK PROGRAM<br />

AAA 24 AUTOMATED BANKING SYSTEM<br />

In this example, EDIT supports conversion between character and binary or<br />

floating point and constructs varying length character fields.<br />

Note: The SEPARATE stage creates individual data records <strong>for</strong> the EDIT stage. If you<br />

omit the SEPARATE stage, only the first data record found appears in the<br />

output.<br />

SQSELECT <strong>for</strong>mats a query against a sample table in the following example:<br />

’pipe NETV SQSELECT * from jtest | COLLECT | CONSOLE’<br />

KWD----- TEXT----------------------------------------------------<br />

CCC TIVOLI NETVIEW FOR <strong>OS</strong>/390 AUTOMATION<br />

BBB NETWORK PROGRAM<br />

AAA AUTOMATED BANKING SYSTEM<br />

Querying a Database and Formatting the Results<br />

Use SQSELECT to issue a DB2 query and converts the result to an easy-to-read,<br />

printable <strong>for</strong>mat with column headings.<br />

SQSELECT:<br />

SQSELECT<br />

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

( SQL options )<br />

DB2 SELECT operands<br />

Note the following when using SQSELECT:<br />

v If the first nonblank character is a left parenthesis, the string up to the first right<br />

parenthesis is processed as options. The remainder of the argument is processed<br />

as a DB2 SELECT statement. The default SQL option is NOCOMMIT and<br />

implies the plan is not closed.<br />

v Code SQSELECT as a first stage in a pipe:<br />

PIPE NETV SQSELECT...<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 337

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

Saved successfully!

Ooh no, something went wrong!