Notes
Slide Show
Outline
1
RDz Workbench – Using the Data Source Explorer
  • Author: Jon Sayles, Enterprise Modernization EcoSystems Team
2
IBM Trademarks and Copyrights
    • © Copyright IBM Corporation 2007,2008, 2009.  All rights reserved.


    • The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied.  IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these materials.  Nothing contained in these materials is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement  governing the use of IBM software. References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates.


    • This information is based on current IBM product plans and strategy, which are subject to change by IBM without notice. Product release dates and/or capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way.


    • IBM, the IBM logo, the on-demand business logo, Rational, the Rational logo, and other IBM Rational products and services are trademarks or registered trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
3
Course Contributing Authors
  • Thanks to the following individuals, for assisting with this course:
    • Reginaldo Barosa/IBM
    • David Bean/IBM



4
Course Overview
  • Audience
    • This course is designed for application developers who have learned or programmed in COBOL, and who need to do z/OS Traditional Development and Maintenance as well as build leading-edge applications using COBOL and Rational Developer for System z.

  • Prerequisites
    • This course assumes that the student has a basic understanding and knowledge of software computing technologies, and general data processing terms, concepts and vocabulary, as well as a working knowledge of COBOL and z/OS.
    • Knowledge of SQL (Structured Query Language) is assumed for database access is assumed as well.
    • Basic PC and mouse-driven development skills, terms and concepts are also assumed.
5
Course Topics
  • Course Name:  Rational Developer for System z Foundation Training


  • Course Description:  Learn how to use Rational Developer for System z to do z/OS traditional development, maintenance, support and for Enterprise Modernization of z/OS applications


  • Pre-requisites: Some experience developing COBOL applications using z/OS is expected.  A working knowledge of SQL is also recommended.


  • Course Length: ~5days – or if done in self-paced mode, at your own pace


  • Topics (Agenda)
      • Getting Started - installing and configuring RDz - and the course  materials, and using Eclipse
      • The RDz Workbench
        • Code analysis tools
        • Editing
        • Compiling programs
        • Debugging local COBOL programs
      • The Data Perspective:
        • Working with relational data sources
        • Modifying test data
        • Editing and testing SQL statements
      • Working with remote system resources:
        • Connecting to a mainframe
        • Data management
        • Accessing and editing files
      • z/OS Application Development
        • Creating MVS Subprojects
        • Creating and customizing project properties
      • Debugging z/OS Applications
        • Debugging Batch Applications
        • Setting Debug Tool for Online Applications
      • Working with File Manager
        • Creating test data
        • Editing complex file-types
      • Working with mainframe ABENDs using Fault Analyzer
        • Creating Fault History views
        • Analyzing and solving mainframe ABENDs
      • Creating and modifying BMS Maps using the BMS Map Editor
6
Topic objectives
  • After completing this topic, you should be able to:
    • Use the RDz Data Perspective to:
      • Connect to local and remote databases
      • Edit test data interactively
      • Display results of SQL queries
      • Perform DBA activities on tables in a local database
      • Display the data model for your application/DB2 tables and views
7
Learning DB2 and SQL
  • Many (in the thousands of) books exist that do an excellent job teaching SQL.


  • Additionally, sites exist on the Internet (GOOGLE:  “SQL tutorials” – or “Learn SQL”) for online (and typically free) education.


  • IBM Also supplies excellent SQL and DB2 documentation:
    • DB2 Documentation
    • SQL Getting Started
    • SQL Reference Manual
    • Message (error code) Reference. Cached pdf version of full guide.
    • DB2 Application Development Guide with example embedded SQL programs.
    • Triggers in DB2
    • Constraints in DB2

  • Note: as before, in order for you to get the above links to work, run the PowerPoint in Slide Show mode.



  • Here’s an example of COBOL database access:
    • http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_samplecoboldrdathreepartnames.htm
8
The RDz Data Tools
9
Why use the RDz Data Tools?
  • But, we currently use SPUFI and QMF for doing DB2 work, why should we change?
  • Simple…
    • 1. Functionality:
      • The RDz Data Tools have vastly superior means of:
        • SQL statement testing
        • Managing your DB2 table test data
          • Full-screen table editing
          • Simple data export/import
        • Doing DBA tasks
        • Understanding your relational data model
      • Easy access from the RDz Workbench
        • The tools are completely integrated into eclipse
    • 2. Cost - z/OS MIPS reduction:
      • RDz is substantially less expensive than TSO/SPUFI or QMF for doing DB2/SQL development
10
The Data Source Explorer
11
Creating a new Connection to a Database
  • You will need the:
    • Database name
    • Host + Port number
      • IP address if shared/network or mainframe DB2
      • localhost if on your Windows machine
    • User ID
    • Password


  • ¤Note that the connection properties are installation and DBMS dependent:
    • DB2 for z/OS requires a "Location" as well as Host name and port number.
    • You would work with your DBA and systems programmer to get these values
12
Connecting to DB2 on z/OS
  • On z/OS you will need to provide a few different pieces of information, in order to connect:
    • Location:
      • Your DB2 DSN
    • Host:
      • The URL/IP Address
    • Do NOT check:
      • Retrieve objects created
      •       by this user only
    • UserID/Password:
      • Required
13
Filtering Schemas and Tables
  • In this course the databases contain a few tables
  • In your world, databases could easily contain:
    • Tens of thousands of tables
    • Thousands of Schemas
  • To simplify working on your projects you should filter the available DB2 objects
  • Two options:
    • By Schemas (one or more checkboxes)
    • With a "LIKE" expression
14
Filtering Schemas and Tables – DB2 on z/OS
  • In the DB2 mainframe world on z/OS databases could easily contain:
      • Tens of thousands of tables
      • Thousands of Schemas
  • To simplify working on your projects filter the available DB2 objects



  • Un-check:  □ Disable Filter
  • Enter: DDS0001
    • In:  ◙ Expression name
15
The Data Source Explorer – Connected
16
Filtering The Data Source Explorer (on the fly)
  • The connection you create to DB2 is based on a                        default filter for schema names, but you're not                         limited to that at all.


  • To re-filter your data objects:
    • Select the connection
    • Right-click and select Properties


  • From Properties you can re-filter:
    • Schema names
    • Stored Procedures
    • Tables

  • Steps:
  • Select the filter
  • Un-check Disable filter
  • Specify your new filter
  • Click OK
17
(Data Model) Overview Diagram – 1 of 4
18
(Data Model) Overview Diagram – 2 of 4
19
(Data Model) Overview Diagram– 3 of 4 (optional features)
20
(Data Model) Overview Diagram– 4 of 4 (Properties View)
21
Additional DBA Features – Generate Table DDL
22
DBA/SQL Programmer Feature – Analyze Impact
  • For tables with DB2-enabled "Referential Integrity"
    • Select a table (either parent or child table)
      • Note that the table should have constraints
    • Right-click and select:  Analyze Impact…


    • Select the type of analysis to perform
      • Only children objects
      • Only parent objects
      • Both children/parent objects
    • Click OK

  • Read the Model report produced
    • Dependent Object is the "child" table or view that will be impacted
    • "Impactor Object" is the parent table or view (of what has been analyzed)
23
Unload (Extract) Rows from a Table
24
Exploring a Table
25
Sample Table Contents
26
Sample Table Contents – at the Column Level
27
Customizing Your Data Perspective Work
  • A number of options                   are available for          managing, controlling                        and customizing the              behavior of the features           in the Data Perspective








  • All available from:
    • Window
      • Preferences
        • Data Management
          • SQL Development
28
Build SQL Statements – Open SQL Scrapbook
29
Create and Run a SQL Scrapbook Statement
30
Building SQL Statements – New SQL Script
31
New SQL Script – Run SQL
32
Using the Data Perspective to do Relative SQL Performance Benchmarks
  • You can use the facilities of the Data Perspective creatively, to benchmark different SQL designs.  Steps:
    • Create a series of SQL statements
      • Sandwich each SQL design between a SELECT of the current timestamp (as shown)
      • After you run your statement series use the timing            data to determine the "relative" performance results                 of each design


  • Optionally –              copy the Result             rows to an external                  file for analysis and            "safe keeping"
33
Copy/Paste an Existing SQL Statement  - 1 of 2
34
Copy/Paste an Existing SQL Statement  - 2 of 2
35
Table Row Value Editing – 1 of 2
36
Table Row Value Editing – 2 of 2
37
RDz Workbench – Using the Data Source Explorer
  • Workshops - 8 7 ¿
38
: Data Perspective – Workshop Plan A – Using your own DB2 Objects
39
: Data Perspective – Workshop Plan B – Using IBM's DB2 Objects
40
: Workshop – Connecting to DB2 on zServerOS
  • On z/OS you will need to provide a few different pieces of information, in order to connect:
    • Location:
      • EOSDB205
    • Host:
    • zserveros.demos.ibm.com
    • Port: 5446
    • User name/Password:
    •   Your assigned UID/PWD
    •       Example:
      • RTPOTnn
      • <password>


41
: Workshop – Filtering Schemas and Tables
  • Recall:
    • In the DB2 world on z/OS databases could easily contain:
      • Tens of thousands of tables
      • Thousands of Schemas
  • To simplify working on your projects filter the available DB2 objects



  • Un-check:  □ Disable Filter
  • Enter: DDS0001
    • In:  ◙ Expression name
42
: Data Perspective Workshop – 1 of 6
43
: Data Perspective Workshop – 2 of 6
44
: Data Perspective Workshop – 3 of 6
45
: Data Perspective Workshop –  Testing SQL Statements – 4 of 6
  • From this slide – copy and all of the commented SQL statements in the Slide Notes
  • From the Data Source Explorer:
    • Click New SQL Script
    • Paste the SQL Statements in the Script1.sql tab
    • Un-comment any# of statements
    • Right-click over the Content Area
    • Select: Run SQL
    • In the Results, for multiple statements you can expand and select one at a time
    • The Result1 tab shows data
    • You will get some errors
  • Optional – try other Context Menu selections like (for the sub-selects) Format SQL
46
: Testing Embedded SQL Using the Data Perspective – 5 of 6
  • From this slide's Notes, copy the COBOL program (name: CURSRAVG)
  • From the z/OS Perspective:
    • Create a new file under the \cobol\  folder in your project
    • Paste the statements into the file and Save (do not Syntax Check)
    • Select and Copy the Interactive portion of the SQL SELECT statement in this paragraph – minus all of the embedded COBOL syntax (shown below in the screen capture)
47
: Testing Embedded SQL Using the Data Perspective – 6 of 6
  • Swap back over to the Data Perspective
  • Either reuse your existing SQL Script, or create              a New SQL Script using the EGLDerbyR7   connection


  • Paste the copied Cursor Declare inside the editor
  • Right-click and select Run SQL
  • Verify the results


48
Topic Summary
  • Now that you have completed this topic, you should be able to:


    • Launch the Data Perspective
    • Connect to a Data Source
    • Use the Data Source Explorer to:
      • View tables and relationships
      • View sample table rows and values
      • Edit (create, update, delete) row values
      • Test interactive SQL
      • Code/Build SQL statements
      • Generate Table DDL

49
RDz Workbench – Using the Data Source Explorer

Appendices
- Connecting to DB2/UDB
- Connecting to a Derby database
50
: Data Perspective Workshop – DB2/UDB
  • From this URL: http://www.ibm.com/developerworks/downloads/im/udb/
    • 1. Download and install UDB on your workstation






    • 2. From RDz and the Data Perspective
      • Create a new connection to the UDB SAMPLE Database
        • See next slide for help with this
      • Select and copy the SQL statements in the slide Notes
      • Create a new SQL Script to the UDB SAMPLE Database
      • Run the script against the SAMPLE Database
      • Refresh the SAMPLE Database in the Explorer


51
: Creating a new Connection to UDB
  • You will need the:
    • Database name: SAMPLE
    • Host + Port number è
      • IP address if shared/network or mainframe DB2
        • Note that the default port is: 50000
      • localhost if on your Windows machine
    • User ID
    • Password

  • Recommend that you save the password properties



52
: Using UDB
  • If you've successfully executed the SQL DDL against the UDB/SAMPLE database you should get the relational objects described in this unit to work with


  • But note that the UDB/SAMPLE database comes with additional:
    • Schemas
    • Objects, including:
      • Stored Procedures
      • Additional tables/views/etc.



53
: Data Perspective Workshop – Derby
54
: Data Perspective Workshop – Derby
55
: Data Perspective Workshop – Derby