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.

Chapter 6. Using <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL Stages <strong>for</strong><br />

Access to DB2<br />

This chapter describes how to use the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> System Query<br />

Language (SQL) stages to access the relational database DB2. Access to SQL is<br />

through pipe stages, enabling you to quickly write powerful systems and network<br />

management applications using REXX, C, PL/I, or other <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong><br />

supported languages. Also, the SQL and SQLCODE provide compatible language<br />

to similar functions available on VM and MVS/TSO. This simplifies work on<br />

multiple plat<strong>for</strong>ms. You can access multiple DB2 databases on the local host.<br />

Accessing and Maintaining Relational Databases (SQL Tables)<br />

<strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL stages can use DB2 if the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong><br />

task DSIDB2MT is started and is connected to a DB2 subsystem. Records are<br />

passed between DB2 and the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL stage without changing<br />

the <strong>for</strong>mat of fields, <strong>for</strong> example, integers are not printable in a query. This gives<br />

you control over the <strong>for</strong>mat of data moving to and from the database. However,<br />

the following sample program SQSELECT, which is supplied with <strong>Tivoli</strong> <strong>NetView</strong><br />

<strong>for</strong> z/<strong>OS</strong> SQL stages, <strong>for</strong>mats a query and converts data from internal<br />

representation to character strings:<br />

SQSELECT * from inventory where substr(description,1,4)=’S390’<br />

SUBAREA_NO DESCRIPTION------------- JOBS_ACTIVE<br />

+221 S390 Raleigh NC +2000<br />

+222 S390 Austin TX +1250<br />

The SQL Stage<br />

The SQL stage connects the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> program to the relational<br />

database product <strong>IBM</strong> DATABASE 2 (DB2) <strong>for</strong> MVS. Potential users of SQL include<br />

the following:<br />

v Novice users of DB2 and <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> pipelines:<br />

– SQSELECT is a <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> REXX procedure to <strong>for</strong>mat a query<br />

<strong>for</strong> display.<br />

– Input lines read by a <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL stage are issued as DB2<br />

statements such as INSERT or SELECT statements. The <strong>for</strong>mat of data is the<br />

internal DB2 <strong>for</strong>mat; use the EDIT stage to convert between external and<br />

internal <strong>for</strong>mats.<br />

v <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> SQL stage users who are new to DB2. Advanced DB2<br />

education is outside the scope of this book. See the examples provided and DB2<br />

publications to learn about DB2.<br />

The REXX samples provide program templates, illustrating the major steps to be<br />

per<strong>for</strong>med. Writing SQL applications using <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> pipelines<br />

eliminates many of the programming details, such as DB2 precompilation,<br />

reentrant considerations, and the details of memory management.<br />

Defining DB2 to the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong> z/<strong>OS</strong> program<br />

v The DSIDB2DF member of DSIPARM is read when task DSIDB2MT starts, and<br />

defines the DB2 subsystem (SUBSYSTEM=DB2) to which the <strong>Tivoli</strong> <strong>NetView</strong> <strong>for</strong><br />

z/<strong>OS</strong> system connects. It uses the following definition statement:<br />

© Copyright <strong>IBM</strong> Corp. 1997, 2011 333

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

Saved successfully!

Ooh no, something went wrong!