® ibm software group © 2013 ibm corporationlast update: august 2013 workshops rdz workbench –...
TRANSCRIPT
®
IBM Software Group
© 2013 IBM CorporationLast Update: August 2013
RDz Workbench – Using the Data Source Explorer
WorkshopsWorkshops
2© 2012 IBM Corporation
Using this PowerPoint Slide Deck
There are two types of slides in this PowerPoint:1. Workshop slides:
These are slides that will help you master RDz through technical development techniques and hands-on exercises
Workshop slides have this character: in the slide header– Note that some workshop slides have the word "Workshop" in the slide header
– However all workshop slides have the character in the slide header
2. Learning content:
Any slide that doesn't contain a character in the slide header contains conceptual learning material– To be read for understanding– Often these slides are preparation for the workshop exercises that follow
There are additional Powerpoint slides that contain deep RDz learning content, without exercises and without lab instructions If you want to learn more about any particular RDz topic, you can
learn more about it from the Powerpoint slides.
3© 2012 IBM Corporation
Data Perspective Workshop – Using Your Company's DB2
If you are connecting to DB2 on your own LPAR, with the help of your DBA and/or Systems Programming staff do the following:
1. Open the Data Perspective2. Connect to a z/OS DB2 database3. Filter the Schema to your table Owner name4. Use the Data Source Explorer:
1. View some of the tables and their relationships through the Overview Diagram
2. Show a table’s Sample Contents
3. Code a few simple SQL statements (or copy/paste from a COBOL program) and run them in a SQL Query
4. Create a simple new SQL statement using the statement builder
5. Edit one of the DB2 tables you have update access to:
– Add a few new rows - Update some values - Delete one or two rows
– Save your changes – Ctrl/SCtrl/S
The slides that follow provide good examples to exercise the techniques demonstrated in this section. Of course you will have to use your own tables, views, etc.
4© 2012 IBM Corporation
Data Perspective Workshop – Using Your Company's DB2 – IBM Data Studio – RDz v9
If you are using RDz v9 shell-sharing with IBM Data Studio 4.1 – return to slides 57 93 in this slide deck and:1. Create connections – to DB2 and through Remote Systems Explorer (RSE)2. Create a Property Group for the RSE connection to pick up your copybooks and
DCLGEN includes3. Create an MVS Subproject – and copy a few DB2/COBOL programs into the
Subproject4. Add Data Access Development Support to the Subproject5. Open a DB2/COBOL program – and start following the use cases shown on
slides: 72 84 in this slide deck, but using your own SQL statements/DB2 tables and views, etc. Note that you may need your DBA’s assistance for doing things like
creating the EXPLAIN/Plan Tables, etc.6. If you have Optim Workload Query Tuner:
And start following the use cases shown on slides: 85 93 in this slide deck, but using one of your own SQL statements
Note that you may need your DBA’s assistance – especially for interpreting the Query Tuning reports, graphs and explorer
You may already have setup connections for DB2 and to your mainframe through RSE – and created an MVS Subproject.
5© 2012 IBM Corporation
Workshop – Connecting to DB2 on zServerOS
For z/OS-DB2 you will need to provide a few different pieces of information, in order to connect:
Select: DB2 for z/OSDB2 for z/OS as the database manager
Location:
EOSDB205Host:zserveros.demos.ibm.com
Port: 54465446User name/Password: Your assigned UID/PWD
Example:
RTPOTnn<password>
Click Next >
6© 2012 IBM Corporation
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
7© 2012 IBM Corporation
Data Perspective Workshop – Data Source Explorer
When your connection create process finishes, you will be returned to the Data Perspective, where you now can: Expand:
Schemas– Synonyms– Tables
– Table elements
– Views
Explore and with the DB2 objects: Expand RESULTS
– Look at the various elements
Expand
8© 2012 IBM Corporation
Workshop – Data (Entity/Relationship) Analysis
Next try the "Overview Diagram" Select one or more tables Right click and select: Add to Overview Diagram Click OK
This opens an Entity/Relationship analysis view
You can also work with a Table, View or Synonym's DDL: Try the following with the CUST table:
1. Extract table data to a comma delimited file on your workstation2. Generate the DDL for your table
Be sure to: BrowseBrowse and select one of your chapter folders Check the option to Open the DDL file for editing
9© 2012 IBM Corporation
Workshop – View, Analyze, Export Data – v8.x
To view your DB2 table data and export reports from it: Select the table or view you wish to edit. Right click and select: Data > Sample Contents
Sortyour results
Export your results
10© 2012 IBM Corporation
Workshop – Read/Only View of a Table's Row Values – v9 From the Data Source Explorer, Right-click over CUST andFrom the Data Source Explorer, Right-click over CUST and
Browse the Data and Sample Contents Try out: New “Select” Script
Press <F5> to run the Select script Value Distributions > Multivariate Repeat these steps with one or two other tables
Caution about the Caution about the Browse Data and Sample Contents Browse Data and Sample Contents These options ignore the Preferences setting for maximum number of rows to return from DB2, and on a very large table will cause Workbench performance problems
11© 2012 IBM Corporation
Workshop Edit Tables
To edit your DB2 table data: Select the table or view you wish to edit Right click and select: Data > Edit Note that you can open (edit) multiple tables. And project them out in multiple window views –
so that you can analyze data, or copy/paste values from one table to another
If you wish to edit subsets of large tables you can use the Optim
Data Studio 3.1.1 – which is a free RDz plug-in
12© 2012 IBM Corporation
Workshop – Table Filtering (v9)From the Data Source ExplorerRight-click CUSTSelect: Data > Edit DataClick: Filter the data
This opens the Table Data Filter dialog
Use the dialog to:Add > Several columns
Add Row Selection Click Add Open the Column
drop-down Open the Operator
drop-down Specify a search value
13© 2012 IBM Corporation
Workshop – Testing Interactive SQL Statements
Click New SQL ScriptNew SQL Script Type in SQL statements Right-click over the
Content Area and select: Run SQL
In the Results, for multiple statements you can expand and select one at a time
The Result1 tab shows statement results
You can Export results
Optional Copy and all of the commented
SQL statements in the Slide Notes
Try other Context Menu selections like Format SQLFormat SQL
Statement Run Console Data Results
14© 2012 IBM Corporation
Workshop – Testing Embedded SQL Statements v8 – 1 of 2
From the Remote Systems view: Open <HLQ>.TEST.COBOL(CURSRAVG) Right-click and from the Context menu select: Filter view > Embedded SQL/CICS/DLI 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)
15© 2012 IBM Corporation
Workshop – Testing Embedded SQL Statements v8 – 2 of 2
Swap back to the script editor and paste the copied embedded SQL inside the SQL script editing area
Right-click and select Run SQL
Try adding an additional where clause predicate What happens when you run the query?
16© 2012 IBM Corporation
Workshop – Testing Embedded SQL Statements v9 with IBM Data Studio 4.1
Open to slide 57 from the PowerPoint titled: RDz Workbench – Using the Data Explorer. Follow the slide instructions/screen captures and do the following:1. Create connections – to DB2 and through Remote Systems Explorer (RSE)2. Create a Property Group for the RSE connection to pick up your copybooks and DCLGEN
includes3. Create an MVS Subproject – and copy a few DB2/COBOL programs into the Subproject
– from the COBOL programs you copied to the host from RDzClass: CURSRAVG.cbl, TRTMNT.cbl, CADDDB2.cbl
4. Add Data Access Development Support to the Subproject5. Open a DB2/COBOL program – and start following the use cases shown on slides:
72 84 in this slide deck, but using your own SQL statements/DB2 tables and views, etc. Note that you may need your DBA’s assistance for doing things like creating the
EXPLAIN/Plan Tables, etc.6. If you are using the zserveros you can use IBM’s Optim Workload Query Tuner:
Start following the use cases shown on slides: 85 93 in the slide deck Tune the SQL statement
From: CURSRAVG.cbl
17© 2012 IBM Corporation
Review – "How do I" (Using RDz, be sure you know how to do the following…)
Access the data tools in the RDz Workbench (how do you open the Data Perspective)? Create a connection to a DB2 region? Filter out Schemas you don't want to see in the Data Source Explorer? View sample rows from a table, view or synonym? Edit a DB2 table? Save changes to my row/column edits? List indexes for a DB2 table Generate the table definition (DDL) for a DB2 table or view? View the different values in a DB2 table column, and see the number of rows each value has in the table? Understand the relationships among a set of DB2 tables – connected with Primary/Foreign key constraints?
i.e. Create an "Entity-Relationship Diagram"
List the primary or foreign key (constraints) for a DB2 table? Understand how an index on a table is designed (to see if it will help make my SQL query faster)? List the columns in a table or view? Change the default maximum number of rows displayed or edited in a table? Code a dynamic SQL statement? Invoke (use) Content Assist to help you code a SQL statement (what two keys??) Run a SQL statement? Code and test (run) multiple SQL statements in one batch (like SPUFI)? Perform (relative) SQL statement efficiency benchmarks? Export rows from SQL results to a: web page, XML file, Excel spreadsheet? "Explain" the plan DB2 will use to access the table? DCLGEN a table?