388
CA Plan Analyzer ® for DB2 for z/OS User Guide r12

CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Embed Size (px)

Citation preview

Page 1: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

CA Plan Analyzer® for DB2 for z/OS

User Guide r12

Page 2: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

This documentation and any related computer software help programs (hereinafter referred to as the "Documentation") are for your informational purposes only and are subject to change or withdrawal by CA at any time.

This Documentation may not be copied, transferred, reproduced, disclosed, modified or duplicated, in whole or in part, without the prior written consent of CA. This Documentation is confidential and proprietary information of CA and may not be used or disclosed by you except as may be permitted in a separate confidentiality agreement between you and CA.

Notwithstanding the foregoing, if you are a licensed user of the software product(s) addressed in the Documentation, you may print a reasonable number of copies of the Documentation for internal use by you and your employees in connection with that software, provided that all CA copyright notices and legends are affixed to each reproduced copy.

The right to print copies of the Documentation is limited to the period during which the applicable license for such software remains in full force and effect. Should the license terminate for any reason, it is your responsibility to certify in writing to CA that all copies and partial copies of the Documentation have been returned to CA or destroyed.

TO THE EXTENT PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS DOCUMENTATION "AS IS" WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT WILL CA BE LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS DOCUMENTATION, INCLUDING WITHOUT LIMITATION, LOST PROFITS, LOST INVESTMENT, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS EXPRESSLY ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.

The use of any software product referenced in the Documentation is governed by the applicable license agreement and is not modified in any way by the terms of this notice.

The manufacturer of this Documentation is CA.

Provided with "Restricted Rights." Use, duplication or disclosure by the United States Government is subject to the restrictions set forth in FAR Sections 12.212, 52.227-14, and 52.227-19(c)(1) - (2) and DFARS Section 252.227-7014(b)(3), as applicable, or their successors.

Copyright © 2009 CA. All rights reserved. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.

Page 3: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

CA Product References This document references the following CA products:

■ CA SQL-Ease® for DB2 for z/OS (CA SQL-Ease)

■ CA Index Expert™ for DB2 for z/OS (CA Index Expert)

■ CA Detector® for DB2 for z/OS (CA Detector)

■ CA Database Analyzer™ for DB2 for z/OS (CA Database Analyzer)

■ CA RC/Query® for DB2 for z/OS (CA RC/Query)

Contact CA Contact Technical Support

For your convenience, CA provides one site where you can access the information you need for your Home Office, Small Business, and Enterprise CA products. At http://ca.com/support, you can access the following:

■ Online and telephone contact information for technical assistance and customer services

■ Information about user communities and forums

■ Product and documentation downloads

■ CA Support policies and guidelines

■ Other helpful resources appropriate for your product

Provide Feedback

If you have comments or questions about CA product documentation, you can send a message to [email protected].

If you would like to provide feedback about CA product documentation, complete our short customer survey, which is also available on the CA Support website, found at http://ca.com/docs.

Page 4: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Documentation Changes The following documentation updates have been made since the last release of this documentation:

■ Statement Reporting (see page 20)—Updated the sample PPA statement reporting menu to show new search elements.

■ Summary Report (see page 28)—Updated the sample Plan Analyzer enhanced explain summary report to show the new report layout.

■ Accessing the Query Explain Database Feature (see page 127)—Added information on cost summary and statement type summary to this topic.

■ Submitting the Batch Processor Data Set (see page 218)—Updated the sample Plan Analyzer enhanced explain summary report in this procedure.

■ Managing Strategy Masks (see page 279)—Updated the procedure for managing strategy masks.

■ Updating Strategy Masks (see page 280)—Updated the procedure for updating strategy masks.

■ Summary Reports (see page 355)—Updated the sample Plan Analyzer enhanced explain summary report to show the new summarized statement information

■ CA Plan Analyzer Health Checks (see page 379)—New appendix.

Page 5: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Contents

Chapter 1: Introduction 15

Features ..................................................................................... 15 Explain Services .......................................................................... 15 Reporting Services ........................................................................ 16 Management Services ..................................................................... 20

Products ..................................................................................... 21 Product Overview ............................................................................. 22

Explain Services .......................................................................... 22 Source Database Maintenance Facility ...................................................... 40 Reporting Services ........................................................................ 40 Plan/Package Management Services ........................................................ 41 Identifying Problem Plans and Packages .................................................... 41 Stored Procedures Maintenance ............................................................ 42 Batch Processor ........................................................................... 42 Batch Reporting Facility ................................................................... 43 Installation Using SMP/E ................................................................... 44 Extended Query Facility ................................................................... 45 Alternate Catalog Mapping ................................................................. 45 Multiple DB2 Subsystems .................................................................. 46 Distributed Data Facility ................................................................... 46 Double-Byte Character Set Support ........................................................ 46

The Main Menu ............................................................................... 47 Basic Header Fields ........................................................................... 51

First Line of the Basic Header .............................................................. 51 Second Line of the Basic Header ........................................................... 51 Header Fields for Controlling the Display, Search, or Function ................................ 52

Chapter 2: Operational Considerations 53

Product Authorization ......................................................................... 53 Operation Level ........................................................................... 54

Improving Performance ....................................................................... 54 Maintaining Objects ....................................................................... 55

Contents 5

Page 6: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 3: Maintaining Profiles 57

Global Profile ................................................................................. 57 Access the Profile Menu ....................................................................... 58 About Floating Point Format Notation .......................................................... 60

Chapter 4: Understanding Current and Future Explains 63

Future Explains ............................................................................... 63 Benefits of Using a Future Explain .......................................................... 64

Current Explains .............................................................................. 64 Benefits of Using a Current Explain ......................................................... 65

Specifying the Explain Type ................................................................... 66 Preparing Plans and Packages ................................................................. 67

Chapter 5: Using Quick Explain and Explain Strategy Services 69

Quick Explain and Explain Strategy Services .................................................... 69 Explaining SQL ............................................................................... 70

About Enhanced Explain ................................................................... 70 About Explain Modes ...................................................................... 72 About Quick Explain and Explain Strategy Services .......................................... 74 About Strategy Versions and Historical Versions ............................................. 75 About Tuning Performance With Optimization Hints .......................................... 75

Choosing Explain Facilities ..................................................................... 76 Procedures for Quick Explain in Regular Mode ............................................... 77

Chapter 6: Querying the Explain Database 127

Accessing the Query Explain Database Feature ................................................ 127 Generating Reports .......................................................................... 128 Controlling Report Hierarchy Display .......................................................... 129

Determining the Initial Hierarchical Level .................................................. 129 Understanding the Hierarchical Display .................................................... 130 Exploding the Report Display ............................................................. 132 Resetting the Report Display .............................................................. 133 Examples ................................................................................ 133 Switching Among Reports ................................................................ 136 Regenerating Reports from the Historical Database ......................................... 137 About the Batch Job ...................................................................... 138 Filtering Reports ......................................................................... 138 Viewing the Database Information Display ................................................. 139 Viewing the Performance Database Display ................................................ 139 Using Line Commands .................................................................... 140

6 User Guide

Page 7: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 7: Comparing Explain Versions 143

What Is Compared ........................................................................... 143 Accessing the Compare Explain Versions Facility ............................................... 144 Comparing Versions of Existing Strategies ..................................................... 144 Using Line Commands ........................................................................ 145 Accessing Online Help ........................................................................ 146

Chapter 8: Updating Expert System Rules 147

Rules Database .............................................................................. 147 Customizing Rules ....................................................................... 148 Updating Thresholds and Severity Codes .................................................. 149 DB2 Versions Supported .................................................................. 150 How Rule Sets Are Used .................................................................. 150 Panel Flow ............................................................................... 151

Default Rule Sets ............................................................................ 151 Creating Rule Sets ........................................................................... 152 Templating Rule Sets ........................................................................ 153 Viewing and Updating Existing Rule Sets ...................................................... 154 Deleting Rule Sets ........................................................................... 155 Filtering the Rules List ....................................................................... 155 Changing the Activation Status of Rules ....................................................... 155 Setting the Notify Option ..................................................................... 156 Printing Rule and Recommendation Text ....................................................... 158 Viewing Rule Violation Notifications ........................................................... 159 Using the Expert System Rules Exit ........................................................... 159

Activating the Exit ....................................................................... 159 Object Module PPAEXIT ................................................................... 160 Linking the Object Module ................................................................ 160 Expert System Rules Exit Communications Block ........................................... 161 Sample Exit - PPAEXIT ................................................................... 165

Chapter 9: Using Reporting Services 167

Accessing a Reporting Service ................................................................ 167 Understanding Header Field Guidelines ........................................................ 168

For All Reporting Services ................................................................ 168 For Plan Reporting ....................................................................... 169 For DBRM Reporting ...................................................................... 169 For Package Reporting ................................................................... 169 For Object Reporting ..................................................................... 169 For Statement Reporting ................................................................. 170

Using Wildcard Characters in Header Fields .................................................... 171

Contents 7

Page 8: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Reports Online.................................................................... 171 Scrolling Through Reports .................................................................... 172 Switching Among Reports .................................................................... 172 Controlling Report Hierarchy Display .......................................................... 173

Determining the Initial Hierarchical Level .................................................. 173 Understanding the Hierarchical Display .................................................... 174 Changing the SQL Statement State ........................................................ 177 Object Dependency Report Examples ...................................................... 178 Statement Report Examples .............................................................. 179

Chapter 10: Using Batch Reporting 181

Batch Reporting Job Submission .............................................................. 181 Batch Reporting Model JCL ................................................................... 183

Default Model JCL Parameters ............................................................ 183 Implementing Plan Analyzer in the Development Cycle ......................................... 184

Development Cycle Support .............................................................. 184 Creating Enhanced Explain Input .......................................................... 185 Creating Strategies and Versions in Batch ................................................. 187 Enhanced Explain Return Codes ........................................................... 188 Sample 1 - After Precompilation ........................................................... 191 Sample 2 - Moving a Plan from Test to Production .......................................... 194

Batch Input ................................................................................. 195 Mode Field ............................................................................... 195 Batch Processor Card Display Panel ....................................................... 196 Online Mode (O) ......................................................................... 198 Batch Mode (B) .......................................................................... 199 Immediate Batch Mode (I) ................................................................ 203 Changing Modes ......................................................................... 207 Sample Scenario ......................................................................... 209

Chapter 11: Identifying Problem Plans and Packages 223

Understanding Problem Conditions ............................................................ 223 Repeatable Read (Plans or Packages) ...................................................... 224 Uncommitted Read ....................................................................... 225 No Isolation Level (Packages Only) ........................................................ 225 VALIDATE(RUN) (Plans or Packages) ...................................................... 225 Invalid (Plans or Packages) ............................................................... 226 Inoperative (Plans or Packages) ........................................................... 226 EXPLAIN(NO) (Plans or Packages) ......................................................... 226 Degree 1 ................................................................................ 227

8 User Guide

Page 9: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Degree Any .............................................................................. 228 Accessing This Feature ................................................................... 228

Generating Reports .......................................................................... 228 Using Line Commands ........................................................................ 229

List of Available Line Commands .......................................................... 230 Accessing Online Help .................................................................... 230

Chapter 12: Identifying Problem SQL 231

Accessing the Identify Problem SQL Facility .................................................... 231 Generating Reports .......................................................................... 232 Regenerating Reports from the Historical Database ............................................ 233 About the Batch Job ......................................................................... 234 Filtering Reports ............................................................................. 234 Using Line Commands ........................................................................ 235

Available Line Commands ................................................................. 235 Accessing Online Help .................................................................... 236

Chapter 13: Using Plan and Package Utilities 237

About the Utilities Option ..................................................................... 237 Importance of DB2 Utility Commands ..................................................... 238 Purpose of Plan/Package Utilities .......................................................... 238 Use for Plan/Package Utilities ............................................................. 239 Summary of the Utility Commands ........................................................ 241

Accessing the Plan/Package Utilities Facility ................................................... 242 Generating Plan and Package Lists ............................................................ 242 Entering Utility and Subreport Commands ..................................................... 243 Handling Triggers ............................................................................ 245 Processing Order ............................................................................ 245

Single Line Command Example ........................................................... 247 Multiple Line Commands Example ......................................................... 250

Canceling Processing ......................................................................... 251 BIND and REBIND with Options ............................................................... 251

Using the BO and RO Utility Line Commands ............................................... 251 Specifying Parameter Options ............................................................. 252 Listing DBRMs, Libraries, and Packages .................................................... 253 List Display Panel ........................................................................ 254 Executing the BIND and REBIND .......................................................... 254

Chapter 14: Create User PLAN_TABLE 257

Creating PLAN_TABLEs ....................................................................... 257 Creating an Index for PLAN_TABLE ............................................................ 259

Contents 9

Page 10: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Statement and Function Tables ...................................................... 260 Changing the List of User IDs ................................................................. 261 Viewing the Selected User Queue ............................................................. 261 Exiting the Selected User Queue .............................................................. 261 Canceling Batch Input ........................................................................ 262 Verifying User Authorizations with CA RC/Query User Reports................................... 262 Accessing the User Reports ................................................................... 263

Chapter 15: Using Statistics Manager 265

Accessing Statistics Manager ................................................................. 265 Accessing Stats Manager Through the Main Menu .......................................... 266 Accessing Stats Manager For a PPA Explain ................................................ 267

Filtering the List of Statistics Strategies ....................................................... 270 Creating Statistics Strategies ................................................................. 271 Managing DB2 Objects ....................................................................... 272 Selecting Objects from the Catalog ............................................................ 273 Specifying Statistics Options .................................................................. 274

Updating Calculation Options ............................................................. 275 Updating Execution Options ............................................................... 276 Updating Reporting Options ............................................................... 277

Managing Strategy Masks .................................................................... 279 Updating Strategy Masks ..................................................................... 280 Deleting Strategy Masks ..................................................................... 280 Updating Statistics Strategies ................................................................. 280 Executing Statistics Strategies and Versions ................................................... 281 Unloading and Loading Data .................................................................. 283 Browsing Statistics Strategies or Strategy Version Definitions ................................... 285 Browsing Execution Options .................................................................. 285 Deleting Statistics Strategies or Strategy Versions ............................................. 286 Toggling the Display of Strategy Versions ..................................................... 286 Viewing the Information Report ............................................................... 287 Viewing Statistics Reports .................................................................... 287 Editing Strategy Statistics .................................................................... 287

Accessing the PSM Catalog Statistics Editor Panel .......................................... 288 Updating Calculation Options ............................................................. 288 Viewing Column Statistics ................................................................ 288 Controlling the Display ................................................................... 289 Calculating and Resetting Object Statistics ................................................. 289 Forcing Statistics Values .................................................................. 290 Setting Statistics to Zero ................................................................. 290 Propagating Cardinality and Statistics ..................................................... 291

10 User Guide

Page 11: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 16: Maintaining the Source Database 293

Accessing the Source Database Maintenance Facility ........................................... 293 Viewing a Source List ........................................................................ 294 Controlling Report Hierarchy .................................................................. 294 Saving SQL Sources ......................................................................... 294 Deleting SQL Sources ........................................................................ 295 Using Line Commands ........................................................................ 296

List of Available Line Commands .......................................................... 296 Accessing Online Help .................................................................... 297

Chapter 17: Maintaining Stored Procedures 299

Accessing the Stored Procedures Maintenance Facility .......................................... 299 Creating Stored Procedures Using Saved Variables ............................................. 300 Using Options ............................................................................... 301 Browsing Stored Procedures .................................................................. 306 Starting Stored Procedures ................................................................... 307 Operations Supported by Primary Commands .................................................. 307 Operations Supported by Line Commands ..................................................... 308

DISPLAYALL Command ................................................................... 308 STARTALL Command ..................................................................... 309 STOPALL Command ...................................................................... 309 D (Display) .............................................................................. 309 SR (Start) ............................................................................... 310 ST (Stop) ................................................................................ 310 B (Browse) .............................................................................. 311

Chapter 18: Maintaining Auto HVersions 313

Accessing the Auto HVersion Maintenance Feature ............................................. 313 Creating Auto HVersion Definitions ............................................................ 314 Filtering the Selection List .................................................................... 315 Updating Auto HVersion Definitions ........................................................... 316 Browsing Auto HVersion Definitions ........................................................... 316 Deleting Auto Hversion Definitions ............................................................ 317

Chapter 19: Maintaining Explain Profiles 319

Accessing the Explain Profile Maintenance Feature ............................................. 319 Creating New Explain Profiles ................................................................. 319 Filtering the Selection List .................................................................... 321 Updating Existing Explain Profiles ............................................................. 321

Contents 11

Page 12: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Browsing Existing Explain Profiles ............................................................. 322 Deleting Explain Profiles ...................................................................... 323

Chapter 20: Maintaining the Plan Table 325

Accessing the Plan Table Maintenance Facility ................................................. 325 Filtering the Selection List .................................................................... 326 Exploding a Plan Table to Plan/Package Detail Level ............................................ 326 Filtering the Plan Table Detail Selection List ................................................... 327 Deleting a Plan/Package ...................................................................... 328 Exploding a Plan Table to Query Detail Level ................................................... 328

Line Commands for Queryno on the Plan Table Query Detail Panel .......................... 328 Line Commands for Qblockno/Planno on the Plan Table Query Detail Panel ................... 329 Primary Line Command for Plan Table Query Detail Panel ................................... 332

Appendix A: Using Performance Data 333

Starting a CA Detector Collection ............................................................. 333 Unloading Collection Data into a Sequential File ................................................ 333

Copying PDTDLOAD ...................................................................... 334 Modifying the PDTULD Step ............................................................... 334 Sequential File Record Layout ............................................................. 335

Loading Performance Data ................................................................... 335 Cards in the Sample Load JCL ................................................................ 336

Appendix B: Performance Recommendations 339

Avoid the DB2 System Catalog ............................................................... 339 Use Alternate Catalog Mapping (ACM) ..................................................... 340 Recommendation Indexes for DB2 Catalog Tables .......................................... 340 Use SRCDBRML Input .................................................................... 340 Use as Few SRCCAT Cards as Possible ..................................................... 340

Reduce the Analysis Request ................................................................. 341 SYSTABLEPART .......................................................................... 341 SYSINDEXPART .......................................................................... 342 SYSKEYS ................................................................................ 342 SYSFIELDS .............................................................................. 342 SYSVIEWS ............................................................................... 342 SYSRELS ................................................................................ 343

Reduce the Amount of SQL Analyzed .......................................................... 343 Cost Filter ............................................................................... 343 Search Condition ......................................................................... 343 Search Filter ............................................................................. 343 Access Path Filter ........................................................................ 344

12 User Guide

Page 13: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Appendix C: Quick Steps 345

Setup Procedures ............................................................................ 345 Steps for the Installer .................................................................... 346 Steps for the Tutorial User ................................................................ 347

Profile Variables ............................................................................. 348 Accessing the Profile Variables ............................................................ 348 Changing the Default Values .............................................................. 348

Explain Strategy Services .................................................................... 348 Accessing the Explain Strategy Services ................................................... 349 Creating a Strategy ...................................................................... 349 Explaining the Strategy ................................................................... 351

Identifying SQL and Object Problems .......................................................... 365 Problem Summary ....................................................................... 366 Identifying Problem SQL .................................................................. 366 Accessing the Identify Problem SQL Option ................................................ 366 Generating the Identify Problem SQL Report ............................................... 367 Interpreting the Identify Problem SQL Report .............................................. 368

Generating Object Reports ................................................................... 369 Accessing the Object Reports Menu ....................................................... 369 Generating the Table Dependency Report .................................................. 370 Interpreting the Table Dependency Report ................................................. 371 Viewing and Hiding Object Qualifiers ...................................................... 372

Altering the Object ........................................................................... 372 Submitting the Data Set Online ........................................................... 373

Correcting Plan Problems ..................................................................... 373 Identifying Problem Plans and Packages ................................................... 374 Accessing the Identify Problem Plan/Package(s) Facility .................................... 374 Selecting Plans or Packages for Display .................................................... 374 Viewing the Problem Plan List ............................................................. 375 Executing a REBIND from the Problem Plan List Panel ...................................... 375 Generating Subreports ................................................................... 376

Reexplaining a Strategy ...................................................................... 376 Setting Up the Explain .................................................................... 377 Interpreting the Results .................................................................. 378

Contents 13

Page 14: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

14 User Guide

Appendix D: CA Plan Analyzer Health Checks 379

DB2_PPA_EXPLAIN_RC1@xmanxxxx .......................................................... 379 DB2_PPA_EXPLAIN_RC2@xmanxxxx .......................................................... 380 DB2_PPA_EXPLAIN_RC3@xmanxxxx .......................................................... 380

Index 383

Page 15: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 1: Introduction

This section contains the following topics:

Features (see page 15) Products (see page 21) Product Overview (see page 22) The Main Menu (see page 47) Basic Header Fields (see page 51)

Features This section introduces you to the basic components of CA Plan Analyzer, its overall design concepts, and security.

Note: This guide assumes that all product components have already been installed at your site. For more information, see the Installation Guide and the Implementation Guide.

CA Plan Analyzer offers the features described in the following sections.

Explain Services

Explain Services, the main component, provides many features that expand on DB2 EXPLAIN processing.

Enhanced explain output

Provides detailed information about access path choices and the factors that led to the path choice. You can view this output in several different types of reports: Summary, Relative Cost, Object Tree, Catalog Statistics, Object Dependency, Access Path Analysis, SQL Analysis, and Predicate Analysis and Referential Integrity.

SQL, object, plan, and predicate analysis facility

Plan Analyzer goes beyond DB2 EXPLAIN analysis with Expert System Rules that govern SQL syntax, physical design, plan design, and use of predicates. You can use these rules to generate reports with accompanying recommendations whenever a conflict occurs during Explain processing. You can use default rules or create custom rule sets.

Grouping of plans, packages, DBRMs, and SQL

You can easily explain an entire application by creating logical groups of SQL, DBRMs, packages, and plans. You can save and reuse groups created through Explain Strategy Services.

Chapter 1: Introduction 15

Page 16: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Features

Explain on multiple subsystems

You can explain a plan or package on multiple subsystems without migrating the plan or package. You can tune applications on your testing subsystem without having to guess how they will perform when bound on your production subsystem.

Easy catalog statistics updates

Plan Analyzer provides access to Statistics Manager for analyzing plan and package performance with projected data statistics. You can commit or roll back any catalog updates.

Reporting Services

Reporting Services provide Plan, DBRM, Package, Object, and Statement Reporting facilities that give you even more information than the DB2 catalog. You can view information about plans, DBRMs, packages, statements, authorities, dependencies. You can also create reports that analyze the relationships between these items. All reports support Distributed Data Facility (DDF) locations.

Plan Reporting

The Plan reports include:

■ Plan List

■ DBRM Detail

■ BIND Parameters

■ Plan Detail

■ Plan Packlist

■ REBIND Parameters

■ SQL Statement

■ Plan Dependency

■ User Authorization

■ Explain

Through the subreport feature, you can enter line commands next to any plans listed on a Plan report to provide additional information about a specific plan. Valid line commands are always shown on the bottom of the screen for easy reference.

16 User Guide

Page 17: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Features

The following illustration shows the Plan List display.

PPPRL -------- PPA Plan List -------- COMMAND ===> SCROLL ===> PAGE Option ===> P Report ===> L Name ===> * Creator ===> USERxx Where ===> N ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD PLAN CREATOR BOUNDBY QUALIFIER BINDDATE BINDTIME VALID ____ PPAD021S xxxxxx 123456 123456 MM/DD/YYYY 21:32:36 YES ____ PPAM021S xxxxxx 123456 123456 MM/DD/YYYY 08:19:29 YES ____ PPAP021S xxxxxx 123456 123456 MM/DD/YYYY 21:32:36 YES ____ PPAU021S xxxxxx 123456 123456 MM/DD/YYYY 21:32:35 YES ____ SQEM021S xxxxxx 123456 123456 MM/DD/YYYY 11:01:54 YES ____ SQEU021S xxxxxx 123456 123456 MM/DD/YYYY 11:01:54 YES ******************************** BOTTOM OF DATA *******************************

The Plan List report, for example, can list multiple plans. To rebind all these plans, simply enter REBIND in the command line. CA Plan Analyzer invokes the Batch Processor to generate the input to execute your request.

DBRM Reporting

DBRM Reporting provides facilities similar to Plan Reporting, but from a DBRM point of view. For example, when you have made changes to a common DBRM, you can quickly find out which plans must be rebound. Once the plans are listed, you can issue the REBIND command to rebind all plans affected by the DBRM change.

DBRM Reporting lets you access other DBRM reports by entering subreport line commands next to any DBRM listed. You can even access Plan Reporting by entering a subreport line command next to a listed plan. Valid line commands are always shown on the bottom of the screen for easy reference.

Chapter 1: Introduction 17

Page 18: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Features

The following illustration shows the DBRM Plan Inclusion display:

PPDRDP -------- PPA DBRM Plan Inclusion -------- COMMAND ===> SCROLL ===> PAGE Option ===> DR Report ===> PI Name ===> * Creator ===> * Where ===> N ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD DBRM PLAN CREATOR DATASET NAME ____ PTADRVAC ____ ACM1DXH1 xxxxxx 123456.RB708AB.DBRMLIB ____ PTAUSER3 ____ ACM1DXH1 xxxxxx 123456.RB708AB.DBRMLIB ____ RGAALTNM ____ ACM1DXH1 xxxxxx 123456.RB708AB.DBRMLIB ____ RGAALTV5 ____ ACM1DXH1 xxxxxx 123456.RB708AB.DBRMLIB ____ PTADRVAC ____ ACM1DXH2 xxxxxx 12345.RB708AA.SMPE.DBRMLIB ____ PTAUSER3 ____ ACM1DXH2 xxxxxx 12345.RB708AA.SMPE.DBRMLIB

Package Reporting

A package contains a single optimized DBRM. Package Reporting displays detailed information about packages and their collections.

For example, the Package Plan Inclusion report displays all the plans within which a package is included. The plans containing the package are indented under the package name for quick reference. This lets you see which plans are affected by a BIND PACKAGE command.

PPPKRPI -------- PPA Package Plan Inclusion -------- COMMAND ===> SCROLL ===> PAGE Option ===> PK Report ===> PI Collection ===> * Package ===> M% Where ===> N Location ===> LOCAL ( Location where the package was bound ) ----------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD PACKAGE COLLECTION PLAN ____ MCTBCSR MCTBCSR ____ CALLPROC ____ MMA$MOD DGL197A_PUT_PMM ____ QCJBTEST ____ MMA$MOD DGL197B_PUT_PMM ____ DGL197B ____ MMA$MOD DGL197C_PUT_PMM ____ DGL197C ____ MMA$MOD UTILPMM$ ____ UTGLPPKG ____ MMA$SAVE DGL197A_PUT_PMM

18 User Guide

Page 19: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Features

As in the other CA Plan Analyzer reports, you can use subreport line commands next to any plans listed to access Plan Reporting. You can also enter subreport line commands next to any packages listed to access other package reports. Valid line commands are always shown on the bottom of the screen for easy reference.

Object Reporting

Object Reporting provides a powerful view into SQL dependency. Using this feature, you can view all plans, collections, DBRMs, packages, and SQL that are dependent on a given database, tablespace, table, index, view, synonym, alias, or even column. With this capability you can answer questions like, “Show me all the SQL in my system that updates the SALARY column.”

The following illustration shows the Column Dependency (Det) display:

PPORTS ------ PPA Column Dependency (Det) --------- COMMAND ===> SCROLL ===> CSR Option ===> O Report ===> C Object ===> SALARY Creator ===> * Where ===> N Plan ===> * DBRM ===> * Type ===> D Collid ===> * Package ===> * ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D41A Version ===> V4R1M0 CMD Column Plan/Collection DBRM/Pkg Stmt SQL STATEMENTS ____ ____ SALARY ____ PPAM0104 ____ PPA$CEVC ____ 2255 SELECT SEQNO , "PLAN" ____ 2279 SELECT SEQNO , "PLAN" ____ PPA$ESM ____ 1439 DELETE FROM PTI.PTPA_ ____ 1474 DELETE FROM PTI.PTPA_ ____ PPA$QEDA ____ 1018 SELECT STRAT_NAME , S ____ 1082 SELECT STRAT_NAME , S ____ 1146 SELECT STRAT_NAME , S ____ 1208 SELECT STRAT_NAME , S ____ PPA$QEDH ____ 1676 SELECT A.STRAT_NAME , ____ 1720 SELECT A.STRAT_NAME , ____ 1764 SELECT A.STRAT_NAME ,

Chapter 1: Introduction 19

Page 20: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Features

Statement Reporting

The Statement Reporting facility is the only syntax-driven SQL query tool in the industry. You can use this option to report on all SQL within your subsystem or on plans that meet certain syntax configurations. This flexibility provides a powerful method for monitoring and enforcing SQL standards at your site. This is the only method available for doing things such as letting you find all SQL with only Stage I predicates or finding all SQL containing correlated subqueries.

XXXX ----------- PPA Statement Reporting Menu ------- YYYY/MMM/DD COMMAND ===> SCROLL ===> CSR Line 1 of 262 Option ===> ST Report ===> Scope ===> B Plan/Collid ===> * DBRM/Pack ===> * UDF Qualifier ===> Where ===> N ----------------------------------------------------------------- USERXXXX Location ===> LOCAL DB2 SSID ===> D81A Version ===> V8R1M0 Choose Statement Types ===> _ SELECT _ INSERT _ UPDATE _ DELETE _ MERGE _ LOCKS Choose one or more elements to search for, joining multiples with OR_ (AND/OR) _ SELECT * _ UNION _ EXCEPT _ INTERSECT _ Multiple row INSERT _ INTO clause _ Distributed Data Facility (DDF) Location Press ENTER to process Press END (PF3/15) to quit

Management Services

Working directly from any report, you can enter primary or line commands to:

■ BIND, FREE, or REBIND some or all of the listed plans or packages

■ Execute utilities through the Plan/Package Utilities menu.

Only CA Plan Analyzer can provide both online and batch processing options for the BIND, FREE, and REBIND utilities.

The Stored Procedures Maintenance facility also lets you create, update, browse, delete, and start stored procedures, and maintain your DB2 SYSIBM.SYSPROCEDURES table.

20 User Guide

Page 21: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Products

Products Plan Analyzer allows you to:

Explain single SQL statements or entire applications

Instead of only being able to obtain explain output at the plan level, CA Plan Analyzer lets you explain whole DB2 systems, specific plans, specific packages, specific DBRMs, specific SQL statements, or even all the SQL statements that perform certain functions or access certain tables. You can save and reuse groups of logically related SQL, DBRMs, packages, plans, and queries using Explain Strategy Services.

Use and update Expert Rules

CA Plan Analyzer provides access to an Expert System that applies the wealth of knowledge contained in a rule base gathered from the industry's foremost DB2 experts.

■ You can use these rules to review your SQL, objects, plans, and predicates and notify you of potential problems. Along with notification, CA Plan Analyzer also provides recommendations for resolving conflicts.

■ You can update these Expert System rules to reflect threshold values for your installations. By updating threshold values and activating or deactivating specific rules, you can create custom rule sets for each of your applications or DB2 subsystems.

Explain test plans on production subsystems

You can execute enhanced explain processing on your production DB2 subsystem for a plan or package that resides on your test subsystem. You can tune applications on your testing subsystem without having to guess how they will perform when bound on your production subsystem.

Explain with projected data statistics

To analyze plan or package performance using projected data statistics, Statistics Manager provides an easy, online method of specifying new values for selected catalog statistics. You can commit or roll back the catalog updates.

Explain access path choices

Enhanced explain analysis includes not only the access path chosen but also the factors that led to its choice. These factors include DB2 catalog statistics and physical object configurations.

Report on SQL performance

You can format Explain output into a variety of reports about your SQL and its performance. For instance, you can view predicate analysis reports that show all involved predicates and whether they are indexable or sargable.

Chapter 1: Introduction 21

Page 22: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Generate online reports

The Reporting Services provide five report options: plan, DBRM, package, object, and statement.

Plan, DBRM, and Package reporting provides catalog information without complex queries or formatting. Object and Statement reporting provides information not available in the DB2 catalog. Report jumping and subreport options let you quickly generate the same report for different plans, packages, or objects, or generate different types of reports.

The Identify Problem Plan/Packages and SQL options give the busy database administrator an easy way to focus attention on problem areas, for example, all SQL that causes tablespace scans.

Solve problems with quick utility execution

From any report panel, you can BIND, REBIND, or FREE some or all of the listed plans or packages by entering primary or line commands.

Work with stored procedures

The Stored Procedures Maintenance Facility makes it easy for you to create, update, browse, delete, and start stored procedures and maintain your DB2 SYSIBM.SYSPROCEDURES table.

Product Overview CA Plan Analyzer is the most complete package available for optimizing, managing, and monitoring DB2 plans and packages. The main menu highlights the components that make CA Plan Analyzer such a comprehensive development and management tool. For more information, see The Main Menu. The following sections describe the facilities within each component.

Explain Services

Explain Services is the cornerstone of CA Plan Analyzer. Explain Services spares you from trying to interpret coded DB2 EXPLAIN output by giving you enhanced explain output in reports. You no longer have to look through cryptic and encoded PLAN_TABLE output, catalog statistics, hard-to-obtain DB2 Optimizer documentation, and object dependency trees to determine what access path DB2 has chosen and, more importantly, why.

Explain Services uses information returned from the DB2 Optimizer with catalog statistics and CA Plan Analyzer Expert System Rules to analyze SQL statements. Enhanced Explain not only provides information that is easier to read than DB2 EXPLAIN output, it provides much more information than DB2 EXPLAIN and lets you gather the information for any group of SQL statements that you might have to process from a single statement to an entire application or system.

22 User Guide

Page 23: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Explain Strategy Services and Quick Explain

The focal point of Explain Services is how CA Plan Analyzer lets you combine SQL sources to be used for Enhanced Explain processing. SQL sources can be:

■ SQL statements

■ Packages

■ File input

■ DBRMs

■ PRF and QMF queries

■ DBRM library input

■ Plans

■ Exported PRF and QMF queries

Two facilities let you group SQL sources:

Explain Strategy Services

Explain Strategy Services lets you save the grouped SQL sources. After a strategy is created, it can be explained over and over. Each time an explain is executed against a strategy, the results of the explain are saved as a version of that strategy.

Quick Explain

The Quick Explain option provides an easy method of grouping SQL sources for ad hoc Enhanced Explain. The main difference between Quick Explain and Explain Strategy Services is that you cannot save enhanced explain reports with Quick Explain. Quick Explain does, however, let you save the information used to create the explain as a historical version of that SQL source.

Both facilities support multiple subsystem explains. Enhanced explain processing lets you explain a plan or package on any DB2 subsystem without moving the plan or package. You simply specify the target subsystem ID (SSID), and CA Plan Analyzer does the rest. You can tune applications on your testing subsystem before they are bound on your production subsystem.

Chapter 1: Introduction 23

Page 24: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

The following is an illustration of the main Explain Strategy Services screen:

PPESM -------- PPA Explain Strategy Services ------- COMMAND ===> SCROLL ===> PAGE Strategy ===> * Creator ===> * Type ===> E ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D61B Version ===> V6R1M0 STRATEGY T D S +----- LAST UPDATE -----+ CMD /VERSION DESCRIPTION CREATOR P B O USER DATE TIME C SCENARIO EXAMPLE SCENARIO STRAT USERxx E U <=== STRATEGY CREATION _ CURTEST USERxx E U USERxx YYYY-MM-DD 12.50 _ CURTEST2 USERxx E U USERxx YYYY-MM-DD 12.54 _ USER USERxx E U USERxx YYYY-MM-DD 15.03 _ V00258 VERSION AUTO CREATED USERxx C M U USERxx YYYY-MM-DD 17.43 _ V00259 VERSION AUTO CREATED USERxx C M U USERxx YYYY-MM-DD 18.19 _ V00260 VERSION AUTO CREATED USERxx C U USERxx YYYY-MM-DD 16.38 _ V00261 VERSION AUTO CREATED USERxx C M U USERxx YYYY-MM-DD 17.28 _ USERDB USERxx E U USERxx YYYY-MM-DD 15.46 _ V00022 VERSION AUTO CREATED USERxx C M U USERxx YYYY-MM-DD 11.46 _ V00023 VERSION AUTO CREATED USERxx C M U USERxx YYYY-MM-DD 12.38

Regular and Expert Mode

Explain Strategy Services and Quick Explain offer two modes to address the needs of a variety of users and situations. With Regular mode, you can specify SQL sources singly or in groups with minimal effort. With Expert mode, you can group multiple SQL sources with more control and options.

Regular Mode

Regular mode condenses the enhanced explain process into its fundamentals so that you use only a few screens and a few options. Default values let a new user begin using CA Plan Analyzeralmost immediately.

24 User Guide

Page 25: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

The following is an illustration of the Quick Explain for regular mode screen:

PPQENE -------------- PPA Quick Explain ------------- COMMAND ===> -------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D61B Target SSID ===> DSN Specify the name of the plan or package that is to be explained or enter selection criteria to view a selection list. Type ===> P ( P - Plan or K - Package ) Plan/Collid ===> DBRM/Package ===> Selection List ===> Y ( Y - Display plan or package selection list ) ( N - Execute explain with selection criteria ) Change Options ===> N ( Y or N ) Profile ===>

Expert Mode

With the Expert mode, you can group and explain single or multiple plans, collections, DBRMs, packages, and SQL statements. Expert mode also lets you group:

■ Report Facility (PRF) queries

■ QMF queries

■ EQF queries

■ DBRM library input

Using one of the data editor screens, you can narrow your explain to a specific SQL statement number, select which rule sets will be used from Update Expert System Rules to analyze the SQL source, update catalog statistics, enter search conditions, and specify filters. Each of these options let you customize how the explain is executed. The Explain Strategy Data Editor screen provides a preview of one of the data editor capabilities.

Chapter 1: Introduction 25

Page 26: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

The following is an illustration of the Explain Strategy Data Editor screen:

PPESDE ------ PPA Explain Strategy Data Editor ------ COMMAND ===> SCROLL ===> PAGE Strategy : SALSTRAT Type ===> E Profile ===> Creator : xxxxxx Share Option ===> U Version : Description ===> YEAR’s SALARIES ----------------------------------------------------------------- xxxxxx ----TARGET--- O C TY SSID RULE SET P LOCATION SSID PLAN/COLLID DBRM/PKG STMT _ A_ D51B ________ _ LOCAL___________ D51B ________________ ________ _____ ******************************** BOTTOM OF DATA *****************************

Catalog Update Facility

During an explain, statistics stored in the DB2 catalog are used to determine the optimal access path. When you want to force the DB2 Optimizer into using other statistics (such as your production statistics), you are left with a major revamping task.

Using the Catalog Update facility, CA Plan Analyzer lets you temporarily change catalog statistics for an explain. You can access the Catalog Update facility from Explain Strategy Services or Quick Explain. The Catalog Update Facility uses Statistics Manager to process statistics. You can commit the catalog updates or roll them back.

The following illustration is an example of updating statistics using the Statistics Manager statistics interface:

PSCATU ------- PSM Catalog Statistics Editor ------- COMMAND ===> SCROLL ===> PAGE Strategy ===> STRT1 Description ===> -------------------------------------------------------------------- xxxxxx Use P or X Line Commands To Propagate Table Cardinality To Dependent Objects CMD OBJECT-NAME QUALIFIER TYPE PART STATUS MULTIPLIER ___ TSTPART2 xxxxxx TS 0 % ___ TSTPART2 xxxxxx TB 0 % ___ TSTPART2 xxxxxx TBS 1 ___ TSTPART2 xxxxxx TBS 2 ___ TSTIXPART2_PART xxxxxx IX ___ TSTIXPART2_PART xxxxxx IXS 1 ___ TSTIXPART2_PART xxxxxx IXS 2 ___ TSTIXPART2_PRMY xxxxxx IX ___ TSTIXPART2_THRD xxxxxx IX ******************************** BOTTOM OF DATA *****************************

26 User Guide

Page 27: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Enhanced Explain Reports

CA Plan Analyzer offers a variety of reports through both Explain Strategy Services and Quick Explain:

■ Summary Reports

■ Cost Reports

■ Access Path Analysis Reports (short and long format)

■ Predicate Analysis Reports (short and long format)

■ Dependency Reports (short and long format)

■ Referential Integrity

■ Tree

– Tablespace report (short and long format)

– Tablepart report (short and long format)

– Table report (short and long format)

– Index report (short and long format)

– Indexpart report (short and long format)

– Column report (short and long format)

– Coldist report (short and long format)

– LOB report (short and long format)

■ Statistics

■ Update Expert System Rules

– SQLRULE (short and long format)

– PHYSRULE (short and long format)

– PREDRULE (short and long format)

– PLANRULE (short and long format)

■ Performance (all and latest statistics format)

■ Compare

Note: To use the previous version of the short Access Path report, short/long SQL Dependency Analysis report, or the short/long Statistics report, you can change the Use New Report Layouts field on the PPA Profile Variables screen or in the PPA parmlib member. For more information about changing the profile, see the chapter “Maintaining Profiles.”

Chapter 1: Introduction 27

Page 28: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Summary Report

The Summary report lists all the SQL statement numbers, SQL statement types, SQL return codes, and the target DB2 subsystem (where the SQL was explained). This report lets you track the SQL Statements that have been explained and their associated SQL return codes.

PPA Vxxx --------- Plan Analyzer Enhanced Explain ------------- Page 2 DATE YY/MM/DD Summary Report TIME HH:MM EXPLAIN PAGE PLAN/COLLECTION DBRM/PKG PACK VERS STMT NUM TYPE SQLCODE NUMBER ------------------ -------- -------------- ---------- ---- ------- ------ *TESTNEWV9 ........,V9NEWEXM, ............., 21,SEL , +0 3 *TESTNEWV9 ........,V9NEWEXM, ............., 34,SEL , +0 4 *TESTNEWV9 ........,V9NEWEXM, ............., 47,SEL , +0 5 *TESTNEWV9 ........,V9NEWEXM, ............., 67,SEL , +0 6 *TESTNEWV9 ........,V9NEWEXM, ............., 73,SEL , +0 7 *TESTNEWV9 ........,V9NEWEXM, ............., 79,SEL , +0 8 *TESTNEWV9 ........,V9NEWEXM, ............., 88,SEL , +0 9 *TESTNEWV9 ........,V9NEWEXM, ............., 109,MRG , +0 10 *TESTNEWV9 ........,V9NEWEXM, ............., 126,MRG , +0 11 *TESTNEWV9 ........,V9NEWEXM, ............., 140,SEL , +0 12 Target DB2 SSID: DBV9 The Most Severe SQLCODE: +0 Source DB2 SSID: DBV9 Total Number of Selects: 8 Collection: TESTNEWV9 Updates: 0 Package : V9NEWEXM Inserts: 0 Stmt : Deletes: 0 : Merges : 2

28 User Guide

Page 29: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Cost Report

For the Cost report, CA Plan Analyzer prepares each SQL statement to retrieve the cost factor returned by DB2. For any group of SQL, you can identify the most expensive SQL in terms of I/O and CPU consumption.

BPPAUDT ------------ AUDIT Message File ----------- COMMAND ===> SCROLL ==> CSR ----------------------------------------------------------- USER ID: xxxxxx --------- Plan Analyzer Enhanced Explain ------------- Page 3 Cost Report TIME 13:40 Relative Cost of CPU and I/O utilization. Most expensive SQL listed first. RELATIVE COST PAGE PLAN/COLLECTION DBRM/PKG PACK VERS STMT NUM TYPE (desc order) NUMBER ------------------ -------- ---------- --------- ---- -------------- ------ PPASCEN1 .........,PPA@SCE3, ........., 11,SEL +0.2538 E+08 17 PPASCEN1 .........,PPA@SCE3, ........., 6,SEL +0.1016 E+07 13 PPASCEN1 .........,PPA@SCE2, ........., 2,SEL +0.1015 E+07 7 PPASCEN1 .........,PPA@SCE3, ........., 3,SEL +0.2675 E+04 11 PPASCEN1 .........,PPA@SCE1, ........., 9,SEL +0.1260 E+04 4

Access Path Analysis Report

The Access Path Analysis report identifies how expensive the SQL statement is and displays the actual plan steps to be executed to satisfy the query requirements. This report is useful in tracking and clarifying each step taken by DB2.

You can also use the Access Path Analysis report when you want to ensure that anticipated index usage is achieved. Information within the plan step includes the tables and indexes accessed, index scans performed for index pages, index scans performed for data pages in clustered index scans, and the lock mode defined for the tablespace.

The regular Access report breaks the information into Query Blocks and Plan Steps. The report format is considered long. The short Access report condenses the Query Blocks and Plan Steps for a quicker look at access path information.

Chapter 1: Introduction 29

Page 30: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Predicate Report

The Predicate Analysis report displays all predicates involved in an SQL statement and indicates whether the predicate is indexable or sargable. The Predicate Analysis report is available in both long and short formats. The following is an illustration of the Predicate Analysis report:

BPPAUDT ------------- AUDIT Message File ---------- COMMAND ===> SCROLL ==> CSR ----------------------------------------------------------- USER ID: xxxxxx SQL Predicate Analysis: Filter Predicate Index Sarge Factor ------------------------------------------------------ ----- ----- -------- STATEMENT #001 ---> NAME <> 'A' No Yes 0.99981 ---> CREATOR = 'A' No Yes 0.99787 ---> NAME = 'B' Yes Yes 0.00019 ---> CREATOR = 'B' Yes Yes 0.00213 ---> OBID > ( SELECT AVG ( OBID ) FROM MKTGDEPT. Yes Yes 1.00000* WAGES WHERE NAME > 'A' AND CREATOR > 'A' ) ---> NAME = 'C' No Yes 0.99981 ---> CREATOR = 'C' No Yes 0.99787 SUBSELECT #001 ---> NAME > 'A' Yes Yes 0.18264 ---> CREATOR > 'A' Yes Yes 0.17511

Dependency Report

The Dependency report displays all object dependency information for an SQL statement. When a referenced object is a synonym, alias, or view, the dependency chain is followed to the base table. All indexes and referenced columns are also identified. The Dependency report is available in both long and short formats.

30 User Guide

Page 31: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Dependency Report - Short Format

The short Dependency report includes all the information the Dependency report displays except the column information. In the example following, the column row has been removed from the header information. This row contained all the column information in the Dependency report.

SQL DEPENDENCY ANALYSIS: TABLESPACE L NACTIVE NTBL PGSZ SIZE TABLE/ALIAS/VIEW/SYNM EV CARD NPAGES PCTPG PCTRC INDEX (# COLS) TYPE UP 1ST/FULL NLEAF NLVL CLUST ------------------------------- -------- -- ---------- ---------- ----- ----- DCV7VWDB.DCV7VWTS SEGMENT A 21780 4 32 32 PDXXX.DCSEG32_JAN TABLE E 6592 1101 5 0 PDXXX.DCSEG32_IXJAN TYPE-2 P 30 33 2 81 (PRIMARY) 1 10000

Dependency Report - Long Format

SQL DEPENDENCY ANALYSIS: TABLESPACE L NACTIVE NTBL PGSZ SIZE TABLE/ALIAS/VIEW/SYNM EV CARD NPAGES PCTPG PCTRC INDEX UP 1ST/FULL NLEAF NLVL CLUST TRIGGER TIME EVENT GRAN COLUMN NP COLCARD LENGTH COLNO COLSQ DISTINCT-TYPE IDENTITY TYPE CACHE CYCLE ORDER ------------------------------- -------- -- ---------- ---------- ----- ----- DCV7VWDB.DCV7VWTS SEGMENT A 21780 4 32 32 PDXXX.DCSEG32_JAN TABLE E 6592 1101 5 0 ** TABLE COLUMNS ** EMP_NO * CHAR 30 9 EMP_ROWID * ROWID 30 17 EMP_RESUME CLOB N 30 4 EMP_401K * INTEGER 25 4 PDXXX.SEQC2MA4NQSQ26Z IDENTCOL 20 NO NO EMP_SALARY DECIMAL 25 11,2 EMP_UDTDEC DISTINCT N 25 9,2 PDXXX.MIX_UDTDEC DECIMAL PDXXX.TRIG1 TRIGGER AFTER UPDATE STMT PDXXX.DCSEG32_IXJAN TYPE-2 P 30 33 2 81 (PRIMARY) 10000 EMP_NO ASC 1 1

Chapter 1: Introduction 31

Page 32: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Referential Integrity Report

The Referential Integrity report displays at the end of each explain source type listing within the Enhanced Explain display. This report offers a visual reference of defined referential relationships and is shown following:

BPPAUDT ------------ AUDIT Message File ------------ COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------ USER ID: xxxxxx -------- Plan Analyzer Enhanced Explain ------------- Page 5 Referential Integrity Report Time 13:46 Table Relname Deleterule Groupname TABLE1.EMP TABLE1.DEPT EMPDEPT SET NULL TABLE1.EMP DEPTEMP SET NULL TABLE1.OPTIONS EMPOPT CASCADE

32 User Guide

Page 33: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Tree Report

The Tree report displays an indented tree diagram of all objects referenced by the SQL statements, including indirect objects such as other tables within the tablespace or referential integrity parent/child relationships.

BPPAUDT ------------- AUDIT Message File ------------ COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx Tree Diagram of Physical Objects. DATABASE (DSNDB06) | +--- TABLESPACE (DSNDB06.SYSDBASE) Non-Partitioned | | | +--- TABLE (SYSIBM.SYSCOLAUTH) | | | +--- TABLE (SYSIBM.SYSCOLUMNS) | | | +--- PRIMARY KEYCOL (TBCREATOR) | +--- PRIMARY KEYCOL (TBNAME) | +--- PRIMARY KEYCOL (COLNO) | | | +--- CHILD TABLE (SYSIBM.SYSFIELDS) DSNDF#FD/CASCADE | | I | | +--- FOREIGN KEYCOL (TBCREATOR) | | +--- FOREIGN KEYCOL (TBNAME) | | +--- FOREIGN KEYCOL (COLNO) | | | +--- INDEX (SYSIBM.DSNDCX01) | | | +--- IXCOL (TBCREATOR) | +--- IXCOL (TBNAME) | +--- IXCOL (NAME) | +--- TABLESPACE (DSNDB06.SYSPLAN) Non-Partitioned | +--- TABLE (SYSIBM.SYSPLAN) | +--- PRIMARY KEYCOL (NAME) | +--- CHILD TABLE (SYSIBM.SYSDBRM) DSNPP#PD/CASCADE | I | +--- FOREIGN KEYCOL (PLNAME) | +--- CHILD TABLE (SYSIBM.SYSPACKLIST) DSNPP@KL/CASCADE

Statistics Report

The Statistics report displays all pertinent DB2 catalog statistics for all DB2 objects referenced by the SQL statements. This report lets you review the statistics that were used for Explain processing. The Statistics report is available in both long and short formats.

Chapter 1: Introduction 33

Page 34: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Statistics Report - Short Format

Object Statistics Report: TABLESPACE DSNDB06.SYSPLAN NACTIVE : 10800 DSSIZE : 0 ---------------- TABLEPART PARTNO: 0 -------------------------- NEARINDREF : 0 FARINDREF: 0 PAGESAVE : 0 PERCACTIVE : 28 PERCDROP : 0 CARD : 69442 EXTENTS : 2 DSNUM : 1 PQTY : 24120 SECQTY : 12060 SPACE : 56160 TABLE SYSIBM.SYSPLAN CARD : 965 NPAGES : 965 PCTROWCOMP: 0 AVGROWLEN : 160 PCTPAGES : 8 SPACE : 151 INDEXES SYSIBM.DSNPPH01 CLUSTRATO: +.5233E+00 1STKEYCARD: 965 FULLKYCARD: 965 CLUSTERNG: YES NLEAF : 4 NLEVELS : 2 -------------- INDEXPART PARTNO: 0 -------------------------- FAROFFPOS: 920 NEAROFFPOS: 32 LEAFDIST : 125 LEAFFAR : N/A LEAFNEAR : N/A PQTY : 60 SECQTY : 60 SPACE : 240 CARD : 965 EXTENTS : N/A DSNUM : N/A COLUMN NAME COLCARD : 965 COLTYPE : CHAR LENGTH : 8 HIGH2KEY : VSQL <HEX> EEDD4444 52830000 LOW2KEY : ACEPTP2 <HEX> CCCDEDF4 13573720

34 User Guide

Page 35: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Statistics Report - Long Format

Object Statistics Report: TABLESPACE DSNDB06.SYSPLAN STATSTIME : 2001-07-21-04.02.54.081406 PGSIZE : 4 NACTIVE : 10800 DSSIZE : 0 ---------------- TABLEPART PARTNO: 0 -------------------------- STATSTIME : 2001-07-21-04.02.54.081406 NEARINDREF : 0 FARINDREF: 0 PAGESAVE : 0 PERCACTIVE : 28 PERCDROP : 0 CARD : 69442 EXTENTS : 2 DSNUM : 1 PQTY : 24120 SECQTY : 12060 SPACE : 56160 TABLE SYSIBM.SYSPLAN STATSTIME : 2001-07-21-04.02.54.081406 CARD : 965 NPAGES : 965 PCTROWCOMP: 0 AVGROWLEN : 160 PCTPAGES : 8 SPACE : 151 INDEX SYSIBM.DSNPPH01 STATSTIME: 2001-07-21-04.02.54.081406 CLUSTRATO: +.5233E+00 1STKEYCARD: 965 FULLKYCARD: 965 CLUSTERNG: YES NLEAF : 4 NLEVELS : 2 SPACE : N/A -------------- INDEXPART PARTNO: 0 --------------------------- STATSTIME: 2001-07-21-04.02.54.081406 FAROFFPOS: 920 NEAROFFPOS: 32 LEAFDIST : 125 LEAFFAR : N/A LEAFNEAR : N/A PQTY : 60 SECQTY : 60 SPACE : 240 CARD : 965 EXTENTS : N/A DSNUM : N/A COLUMN NAME COLCARD : 965 COLTYPE : CHAR LENGTH : 8 STATSTIME: 2001-07-21-04.02.54.081406 NULLS : NO HIGH2KEY : VSQL <HEX> EEDD4444 52830000 LOW2KEY : ACEPTP2 <HEX> CCCDEDF4 13573720

Update Expert System Rules

When you group SQL sources using Explain Strategy Services or Quick Explain, you specify which Enhanced Explain reports should be generated. Four of the CA Plan Analyzer enhanced explain reports (SQLRULE, PHYSRULE, PLANRULE, and PREDRULE) use Expert System Rules.

Chapter 1: Introduction 35

Page 36: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

The rule set used to analyze your SQL depends on the rule set you specified in the Explain Strategy Services or Quick Explain facility. The Update Expert System Rules facility creates the rule sets. The following shows the Expert Systems Rule Set Maintenance screen that you use to begin working with rule sets:

PPUESM ---- PPA Expert Systems Rule Set Maintenance --- COMMAND ===> SCROLL ===> PAGE Rules SSID ===> * Rule Set ===> * Creator ===> * ----------------------------------------------------------------- xxxxxx DB2 SSID ===> D51B Version ===> V5R1M0 S +------ LAST UPDATE ------+ CMD SSID RULE SET DESCRIPTION CREATOR O USER DATE TIME _ ____ ________ ______________________ xxxxxx U <===== NEW SET CREATION _ D51B @DEFAULT DEFAULT RULESET xxxxxx U xxxxxx YYYY-MM-DD 14.41 ******************************** BOTTOM OF DATA *******************************

CA Plan Analyzer lets you create custom sets of rules for different applications or DB2 subsystems. This rule base contains a variety of thresholds that you can customize for subsystem-specific tuning of your DB2 applications. You can also assign severity codes to the rules. Severity codes are used when any Expert System rules are violated. The highest severity code CA Plan Analyzer encounters when you execute the batch input is the return code for the job.

Additionally, using a user-written exit, you can:

■ Intercept rules.

■ Decide whether they should be displayed.

■ Change the severity code of the rules.

■ Add customized text when the rules are displayed.

SQL Analysis Report

CA Plan Analyzer provides additional information that helps you understand why the DB2 Optimizer did what it did. Listings of the SQL Expert System Rules used for Enhanced Explain processing provide insights into how the DB2 Optimizer is processing your SQL, physical objects, and plans. The SQL Analysis report shown below recommends SQL changes that would improve locking and data access based on the SQL rules. Similar reports are available for physical, plan, and predicate rules.

36 User Guide

Page 37: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

SQL Analysis Report - Short Format

BPPAUDT ------------- AUDIT Message File ---------- COMMAND ===> SCROLL ==> CSR ----------------------------------------------------------- USER ID: xxxxxx SQL Design Rule: 0071 -------------------------------- Severity Code = 0 This SQL uses the MAX column function on the column "COL3" of the table "PDMARY.TSTPART1". RECOMMENDATION: 0076 Place an descending index on this column to allow DB2 to obtain the maximum value via a Fetch Index scan. A Fetch Index scan will just read the first page of the index to obtain the maximum value for this column. SQL Design Rule: 0071 SC: 0 Recommendation: 0076 Page: 36 Value for COLUMN is: COL2 Value for TABLE is: xxxxxx.TSTPART1

SQL Analysis Report - Long Format

BPPAUDT ------------- AUDIT Message File ------------ COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx SQL Design Rule: 0059 --------------------------------------------------------- This SQL statement contains the following search condition: A.STRAT_NAME = B.STRAT_NAME AND A.STRAT_CREATOR = B.STRAT_CREATOR This search condition is of the form "predicate1 AND predicate2" , where both predicates are indexable, and as a result may be eligible for Multiple Index processing. RECOMMENDATION: 0108 Consider creating indexes on the columns in these predicates, if none exist already, to allow DB2 to use indexes for the predicate evaluation. If you have defined separate indexes on each predicate, DB2 might use a multiple index path. If not, both parts of the predicate must see columns of the same index for the combined predicate to be indexable. If DB2 decides to use a multiple index path, DB2 will build eligible row ID (RID) lists using an index for each predicate and then UNION/INTERSECT these RID lists together to build a composite RID list. This composite RID list will be sorted into ascending row ID order and will be used to access the necessary data pages.

Compare Explain Versions

Compare Explain Versions lets you compare historical versions of a variety of SQL sources including those contained in CA Plan Analyzer explain strategies. You can compare versions for the following SQL sources:

■ Plan

■ Package

Chapter 1: Introduction 37

Page 38: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

■ SQL and SQL contained in a CA Plan Analyzer strategy

■ DBRMLIB

■ File

■ Report Facility and Exported Report Facility query

■ QMF and Exported QMF query

The following shows a portion of a Compare Explain Versions report:

----- PPA Compare Explain Versions Display ----- COMMAND ===> SCROLL ===> CSR LINE 33 OF 94 PPA REL. 2.3 --------- Compare Explain Versions ------------- Page 2 DATE yy/mm/dd DEGREE 1 V DEGREE A POST TIME 21:31 Old: Source: New: Source: Statement: 1 Statement: 1 Access Path Analysis: PQbkNo: 0 QblkNo: 1 PlanNo: 1 MxOpSq: 0 TBTyp: TABLE Access: IXDATA TSLock: IS Prefet: S QblkTy: SEL TabNo: 1 Table : SYSIBM.SYSTABLES CorrNm: A Index : SYSIBM.DSNDTX02 MCols : 0 PQbkNo: 0 QblkNo: 1 PlanNo: 2 MxOpSq: 0 TBTyp: TABLE Access: IXDATA TSLock: IS Prefet: QblkTy: SEL TabNo: 2 Method: Nested Loop Join JoinTy: Inner MergJC: Table : SYSIBM.SYSCOLUMNS CorrNm: B Index : SYSIBM.DSNDCX01 MCols : 2 Sorts Composite Unique: N Join : Y Ordrby: N Grpby: N PllMod: QUERY CP AcDegr: 6 AcPgrp: 2 SrtnPg: JnDegr: 6 JnPgrp: 2 SrtcPg: Old SQL Statement: SELECT * FROM SYSIBM.SYSTABLES A , SYSIBM.SYSCOLUMNS B WHERE A.NAME = B.TBNAME AND A.CREATOR = B.TBCREATOR Press ENTER to process Press END (PF3/15) to quit

38 User Guide

Page 39: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Query Explain Database

You can query the historical database with the Query Explain Database facility to retrieve information about an explained strategy.

Query Explain Database presents the information within four reports. For example, you can determine:

■ Access methods used most frequently by your SQL (Explain Summary report)

■ Most costly SQL statements (Cost Summary report)

■ Most frequently used statement types (Statement Summary report)

■ Objects referenced within the explained SQL (Object Summary report).

The following shows the Explain Summary report. The Explain Summary report helps you determine the access paths DB2 will use when the explained SQL is executed.

PPQDES ------- PPA QED Explain Summary ------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> Cost ===> Plan ===> PPASCEN1 DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> Creator ===> Type ===> --------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ CURRENT Man ____ PPASCEN1 (PL) 3 2 1 - 5 1 ****************************** BOTTOM OF DATA *******************************

Chapter 1: Introduction 39

Page 40: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Source Database Maintenance Facility

The Source Database Maintenance facility helps you maintain the integrity of your historical database by letting you save, rename, or delete SQL sources. The following example shows the Database Maintenance Information Summary panel.

PPPDMSD ------- PPA DM Info. Summary ------- COMMAND ===> SCROLL ===> PAGE HVersion ===> 1234HVER Plan ===> * DBRM ===> STMTNO ===> Collid ===> * Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART CMD GROUP/OBJECT/STMT Type DCVC SSID LOCATION ____ 1234HVER Auto ____ Level +0 ____ PLANGEN1 (PL) D51B ____ PACKGEN_COLL_FREE (CO) D51B ____ Level +1 ____ PLANGEN1 (PL) R D51B ____ PACKGEN_COLL_FREE (CO) R D51B ____ Level +2 ____ PLANGEN1 (PL) R D51B ____ PACKGEN_COLL_FREE (CO) R D51B

Reporting Services

With Reporting Services, you do not have to write complex queries. You have five options to monitor your plans, DBRMs, objects, and SQL statements:

■ Plan Reporting

■ Package Reporting

■ Statement Reporting

■ DBRM Reporting

■ Object Reporting

These reporting facilities provide information that is not available from the DB2 system catalog.

By changing the report header, you can generate the same report for different plans, packages, or objects without exiting the current report. Subreport options also let you enter commands to generate subreports for items listed on a report.

40 User Guide

Page 41: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

All reports support Distributed Data Facility (DDF) locations. By letting you change the Location and DB2 SSID on any report panel, you can navigate your way though many DB2 subsystems. You can produce reports in online or batch mode. You can also extend the WHERE clause on any SQL statement using the Extended Query Facility (EQF).

Plan/Package Management Services

Plan/Package Management Services help identify problem plans and packages, correct these problems by executing utilities from online report panels, and create PLAN_TABLEs for multiple users with an online interface. This management tool set also includes a Stored Procedures Maintenance facility to let you manage your SYSIBM.SYSPROCEDURES table at the same time you are caring for your plans and packages.

Identifying Problem Plans and Packages

As discussed in the Identifying SQL and Object Problems section, Object Reporting displays only those objects dependent on the selected object. Predicting which plans have been invalidated (by altering an object) would be time consuming if you used only Object Reporting, especially if many objects have been altered. A more efficient alternative is to use CA Plan Analyzer's Identify Problem Plan/Package(s) facility to quickly identify all the plans invalidated by altering an object.

The Object Reporting output showed that plan PPASCEN1 referenced object DEMO_SCENARIO1. Therefore, PPASCEN1 was invalidated when you altered DEMO_SCENARIO1.

This exercise teaches you how to check the validity of plans and then use the Identify Problem Plan/Package(s) facility to execute a REBIND against the invalidated plan.

Chapter 1: Introduction 41

Page 42: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Stored Procedures Maintenance

The Stored Procedures Maintenance facility helps you create, update, browse, delete, and start stored procedures and maintain your DB2 SYSIBM.SYSPROCEDURES table. The Stored Procedures Maintenance panel is shown in the following example.

PPPPRC ------- PPA Stored Procedures Maintenance ------ COMMAND ===> SCROLL ===> CSR Procedure ===> * Authid ===> * LUname ===> * --------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D41A Version ===> V4R1M0 LAST LAST IBM -LOCATED- CMD PROCEDURE NAME AUTHID LUNAME ACTION USER STATUS IBM PPA ___ __________________ ________ ________ <=== STORED PROCEDURE CREATION === ___ DB2_PROCEDURE D41APTIA CREATED xxxxxx Y Y ___ DDELSP NEW xxxxxx Y ___ DINSSP NEW xxxxxx Y ___ DTEST NEW xxxxxx Y ___ GAR1 CREATED xxxxxx STOPREJ Y ___ GLS_PROCEDURE NEW xxxxxx Y ___ MCTBCSR UPDATED xxxxxx Y Y ___ PDJLI_PROCEDURE2 USERxx D41APTIA NEW xxxxxx Y ___ PDTAM_DTB1DEL NEW xxxxxx Y ___ PPA_PROCEDURE D41ADB2 UPDATED xxxxxx STOPREJ Y Y ___ SCOMSP NEW xxxxxx Y ___ SCSRSP NEW xxxxxx Y

Batch Processor

CA Plan Analyzer invokes the Batch Processor when you use the Create User PLAN_TABLEs, Plan/Package Utilities, and Explain Services features online or in batch mode. For example, when you request a REBIND of all plans listed from a plan report, CA Plan Analyzer invokes the Batch Processor to write the input needed to execute the REBIND utility command.

42 User Guide

Page 43: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

CA Plan Analyzer can also list the batch input used to execute your request on the Batch Processor Card Display panel. The following example shows the batch input to rebind the plans listed from a Plan List report.

PPPBPDI ------- PPA Batch Processor Card Display ------ COMMAND ===> SCROLL ===> CSR Mode ===> O ONLINE The following Batch Processor input has been generated. Press ENTER to process, press END to cancel, or enter the EDIT command to edit. ----------------------------------------------------------------- xxxxxx ********************************* TOP OF DATA ********************************* .CALL DSN PARM(D41A) .DATA REBIND PLAN ( PPASCEN1 ) OWNER ( USERxx ) - QUALIFIER ( USERxx ) CACHESIZE ( 1024 ) - - VALIDATE ( RUN ) DEGREE ( 1 ) - ISOLATION ( CS ) ACQUIRE ( USE ) - RELEASE ( COMMIT ) EXPLAIN ( NO ) - - NODEFER ( PREPARE ) CURRENTDATA ( YES ) - SQLRULES ( DB2 ) DISCONNECT ( EXPLICIT ) - DYNAMICRULES ( ); .ENDDATA ******************************** BOTTOM OF DATA *******************************

CA Plan Analyzer lets you execute the job in online, batch, or immediate batch mode. In the example, a REBIND is requested for listed plans. Submit the generated cards through the Batch Processor, and all your plans are rebound.

Note: For more information, see the Batch Processor Reference Guide.

Batch Reporting Facility

The Batch Reporting facility lets you generate CA Plan Analyzer reports in batch mode. Batch Reporting creates a job stream that contains the JCL commands and control information necessary to generate and print the reports.

Chapter 1: Introduction 43

Page 44: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

You can access the Batch Reporting facility from the Plan Reporting, DBRM Reporting, Package Reporting, Object Reporting, Statement Reporting, Identify Problem SQL, and Query Explain Database menus and reports by entering the BATCH primary command. The Job Submission panel defines the parameters necessary to execute the report in batch mode.

PPPPRMB ------ PPA Batch Reporting Job Submission ----- Option ===> ( S - Submit, E - Edit, D - Write to Dataset ) Action ===> ( B - Bind, R - Rebind, F - Free --- Plans/Pkgs) ----------------------------------------------------------------- xxxxxx JOBCARD ===> //123456BP JOB (TD20-230-BAT),'IPP BATCH',CLASS=A,MSGCLASS=X, ===> // REGION=4096K ===> ===> SYSOUT ===> X (JES SYSOUT class to be used) ******************************** REPORT INPUT ******************************* USERID = (xxxxxx) SSID = (D41A) LOCATION = (LOCAL) ACM = (Y,123456) LINES = (0060) LINESZ = (133) OPTION = (P) REPORT = (L) NAME = (*) CREATOR = (*)

Note: Do not confuse the Batch Reporting facility with the Batch Processor. The Batch Processor is a product for processing data sets that contain SQL and special Batch Processor commands. Batch Reporting is a facility for generating reports in batch.

Installation Using SMP/E

You can install CA Plan Analyzer using the IBM System Modification Program/Extended (SMP/E) feature. SMP/E provides access to specific information about the release and maintenance level of the product you are installing, and lets you test the product and maintenance for installability before accepting them into your product environment.

SMP/E lets you replace an object and propagate this change throughout all load modules. This capability lets Technical Support correct customer problems quickly and minimizes the need for zaps.

44 User Guide

Page 45: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Extended Query Facility

The Extended Query Facility (EQF) lets you customize internal SELECT statements to control the data returned. Extended queries are used to control the data displayed on selection lists and reports.

For example, when you are viewing a plan listing, you might want to view only valid plans that were bound within a specific time range. Using EQF, you enter the custom selection criteria, and they are executed as part of the internal SQL statements.

You can save, share, and execute extended queries in online or batch mode. EQF also supports the use of symbolic variables that permit run-time customization of the search criteria. EQF is common to most MVS products for DB2.

Alternate Catalog Mapping

Alternate Catalog Mapping (ACM) is a facility used by several CA-DB2 products. ACM lets you define shadow tables or views for the DB2 system catalog tables. You can use views to control access to the information in the catalog and use shadow catalog tables to reduce contention on the DB2 catalog. You can define any combination of shadow tables and views.

CA Plan Analyzer supports ACM, which lets you control access to the DB2 system catalog for each user. You must activate ACM through the CA-DB2 Products Main Menu (ACM set to ON) before you can use ACM.

When you activate ACM for a user, dynamic SQL is used because the SQL statement is prepared dynamically based on the alternate table/view names. Therefore, you must have SELECT authority on the alternate views, tables, or both.

Note: For more information, see the Value Pack Reference Guide.

Chapter 1: Introduction 45

Page 46: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Product Overview

Multiple DB2 Subsystems

CA Plan Analyzer lets you switch between different DB2 subsystems, even different DB2 versions, without having to exit CA Plan Analyzer and reallocate load libraries. To switch subsystems, enter the new subsystem ID in the DB2 subsystem ID field (SSID), which appears on most CA Plan Analyzer panels. This feature lets you view a CA Plan Analyzer report on one subsystem, change the SSID, and view the same CA Plan Analyzer report on the newly specified subsystem. You can even select a subsystem from a subsystem listing.

Note: For more information, see the General Facilities Reference Guide. In general, you can use products in a split panel mode. However, because the DB2 Call Attach Facility does not let you connect to two different subsystems simultaneously, you might encounter unpredictable results if you change subsystems in one of the sessions. For more information, see the IBM DB2 Application Programming and SQL Guide.

Distributed Data Facility

CA Plan Analyzersupports the Distributed Data Facility (DDF). CA Plan Analyzer implements DDF to let you view plan reports at remote installations. A Location prompt on all report panels lets you switch to a different location. You can view two different locations at the same time becauseCA Plan Analyzer supports split panel mode. Enter a question mark (?) for Location to receive a listing of valid locations.

When you use DDF, all remote SQL is dynamic because it must be bound on the remote system. CA Plan Analyzer automatically adds the FOR FETCH ONLY clause to provide the most efficient data retrieval across the network.

Double-Byte Character Set Support

CA Plan Analyzer supports double-byte character sets. The languages in countries such as China, Japan, and Korea use writing schemes that consist of large character sets which cannot be represented with one-byte codes. For example, Kanji (used in Japan) and Hanzi (used in China) each contain several thousand characters. A character set, DBCS (Double-Byte Character Set), has been created to represent these characters. DBCS uses two bytes per character.

Note: For more information, see the IBM DBCS Applications Primer Guide and DBCS Design Guide.

46 User Guide

Page 47: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

The Main Menu

The Main Menu The Main Menu shows your options. Options are identified with a corresponding alpha or numeric code. The following example shows the Main Menu.

PPM ----------- CA - Plan Analyzer Main Menu ---------- COMMAND ===> ACM ===> OFF Mode ===> O ONLINE ---------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51C Version ===> V5R1M0 EXPLAIN Services Reporting Services 1) Quick EXPLAIN 6) Plan Reporting 2) EXPLAIN Strategy Services 7) DBRM Reporting 3) Query EXPLAIN Database 8) Package Reporting 4) Compare EXPLAIN Versions 9) Object Reporting 5) Update Expert System Rules 10) Statement Reporting Plan/Package Management Miscellaneous Functions 11) Identify Problem Plan/Package(s) A) Administrative Functions 12) Identify Problem SQL P) Profile 13) Plan/Package Utilities S) Statistics Manager 14) Create User PLAN_TABLE(s) T) Tutorial BP) Batch Processor/Submit X) Exit Plan Analyzer

The following describes the fields shown on the Main Menu and how to select an option from the menu:

ACM

(Display only) Indicates whether the Alternate Catalog Mapping facility is ON (enabled) or OFF.

Note: For more information, see the Value Pack Reference Guide.

Mode

Indicate the mode to use for the facility requested from the Main Menu when the facility needs SQL statements, DDL statements, and Batch Processor commands executed.

For example, when you request the Plan Reporting option, Plan Analyzer uses the mode specified to generate the batch input for any requested utilities (BIND, REBIND, FREE).

Chapter 1: Introduction 47

Page 48: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

The Main Menu

Valid values are:

O

Online

B

Batch

I

Immediate Batch

You can change the value for the Mode field by clearing the old value and then entering a new value. You can also enter MODE in the command line.

Note: For more information, see the CA Plan Analyzer Reference Guide.

The Mode field does not control how CA Plan Analyzer reports are generated. CA Plan Analyzerreports are generated online unless you request batch reporting by entering BATCH. For information about batch generation, see the chapter “Using Batch Reporting."

Location, DB2 SSID, Version

Specifies where the DB2 objects reside.

Note: For more information, see the General Facilities Reference Guide.

EXPLAIN Services

Shows the Explain Services components and the numeric identifier you use to request access to them.

1

Quick EXPLAIN

2

EXPLAIN Strategy Services

3

Query EXPLAIN Database

4

Compare EXPLAIN Versions

5

Update Expert System Rules

48 User Guide

Page 49: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

The Main Menu

Reporting Services

Shows the Reporting Services components and the numeric identifier you use to request access to them.

6

Plan Reporting

7

DBRM Reporting

8

Package Reporting

9

Object Reporting

10

Statement Reporting

Plan/Package Management

Shows the Plan and Package Management components and the numeric identifier you use to request access to them.

11

Identify Problem Plan/Packages

12

Identify Problem SQL

13

Plan/Package Utilities

14

Create User PLAN_TABLEs

Miscellaneous Functions

Shows the remaining CA Plan Analyzer components and the alpha identifier you use to request access to them. Additionally, this section indicates that you use X (Exit) to exit CA Plan Analyzer.

A

Administrative Functions

P

Profile

S

Statistics Manager

Chapter 1: Introduction 49

Page 50: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

The Main Menu

T

Tutorial

BP

Batch Processor/Submit

X

Exit CA Plan Analyzer

When you enter A, the Administrative Functions menu panel appears.

PPADM ------------ Administrative Functions ----------- COMMAND ===> ---------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D71A Version ===> V7R1M0 1) Source Database Maintenance 2) Stored Procedures Maintenance 3) Auto HVersion Maintenance 4) Explain Profile Maintenance 5) PLAN_TABLE Maintenance

From this panel, you can enter any of the following options in the command line:

■ Enter 1 to access the Source Database Maintenance feature.

■ Enter 2 to access the Stored Procedures Maintenance feature.

■ Enter 3 to access the Auto HVersion Maintenance feature.

■ Enter 4 to access the Explain Profile Maintenance feature.

■ Enter 5 to access the PLAN_TABLE Maintenance feature.

After selecting an option from the Main Menu or the Administrative Functions panel, the appropriate menu, report, or listing appears. The items within a report or listing match whatever selection criteria you entered in the header fields.

You can return to the Main Menu from any panel within CA Plan Analyzer by entering MAIN in any command line or by pressing the appropriate PF key.

Note: For more information, see the General Facilities Reference Guide.

50 User Guide

Page 51: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Basic Header Fields

Basic Header Fields This section describes the different kinds of fields in the headers of CA Plan Analyzer panels. The header is everything toward the top of the panel and above the horizontal line that ends with the current TSO user ID. Typically, Location, SSID, and Version appear below that horizontal line.

Note: For more information, see the General Facilities Reference Guide.

The chapters covering the CA Plan Analyzer features each have a section describing the header fields unique to that feature. When the CA Plan Analyzer panel you are viewing has only the basic header fields, refer back to this section for the descriptions of those fields.

Typically, a CA Plan Analyzer panel header includes the following:

■ The name and release of the product

■ The name of the panel and the date and time you access the panel

■ The COMMAND field, called the command line, which you use for entering primary commands

■ The SCROLL field, which you use to indicate your scrolling preference

■ The current TSO user ID

First Line of the Basic Header

The first line of the panel contains the following information:

■ The code that identifies the panel

■ The version of the product you are working in, sometimes showing R (for Release) as the first character

■ The name of the panel

■ The date and time you accessed the panel

Second Line of the Basic Header

The second line of the basic header includes the COMMAND and SCROLL fields.

Chapter 1: Introduction 51

Page 52: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Basic Header Fields

52 User Guide

Header Fields for Controlling the Display, Search, or Function

Many of the CA Plan Analyzerfeatures have header fields that you can use to control the display, search, or function you are initiating. The following sections describe examples of these kinds of header fields.

Page 53: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 2: Operational Considerations

This section contains the following topics:

Product Authorization (see page 53) Improving Performance (see page 54)

Product Authorization This section contains information you need to know before you use CA Plan Analyzer.

Before running CA Plan Analyzer review the following authorization requirements:

■ To run CA Plan Analyzer, you must grant the user authority to execute the Batch Processor.

Note: For more information, see the General Facilities Reference Guide.

■ To update DB2 catalog statistics through the Catalog Statistics facility, you must grant the user authority to execute the Catalog Extract plan (found in the Database Analyzer category).

Note: For more information, see the CA Database AnalyzerUser Guide.

■ To use with Database Analyzer Statistics, you must grant the user authority to execute the statistics plan (found in the Database Analyzer category).

Note: For more information, see the CA Database Analyzer User Guide.

■ To execute commands through the DB2 Command Processor, you must grant the user authority to execute this function (found in the General category).

Note: For more information, see the General Facilities Reference Guide.

You can grant or revoke authorization to the following CA Plan Analyzer functions:

PPA Main Plan

Lets the user execute all product features, except for Update Expert System Rules.

PPA Rule Admin

Lets the user execute the Update Expert System Rules feature, which includes updating, creating, templating, and deleting rule sets.

Chapter 2: Operational Considerations 53

Page 54: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Improving Performance

PPA Database Maint

Lets the user perform any operations in the Source Database Maintenance facility.

PPA Procedure Maint

Lets the user perform any operations in the Stored Procedures Maintenance facility.

PSM Main Plan

Lets the user perform any operations in the Statistics Manager facility.

Note: For more information, see the General Facilities Reference Guide.

Operation Level

Many of the security restrictions discussed in this section are implemented by the DB2 security system. CA Plan Analyzer never permits users to bypass DB2 security. CA Plan Analyzer provides additional security through the authorization exit and Product Authorization facilities.

Note: For more information, see the General Facilities Reference Guide.

Improving Performance You can attempt to improve performance by creating additional indexes on the SYSDBRM, SYSFIELDS, and SYSSTMT DB2 catalog tables.

Note: For more information about creating additional indexes on these DB2 catalog tables, see the Implementation Guide. We cannot guarantee performance improvement as a result of the creation of these suggested indexes. If you do not experience a performance improvement as a result of creating the indexes, consider removing them.

After you have created the indexes, execute RUNSTATS against the new indexes. Then, rebind the CA Plan Analyzer plan and packages to utilize the new access paths. These new catalog indexes can improve performance in the following product areas:

■ Quick Explain

■ Explain Strategy Service

■ Plan Reporting

■ DBRM Reporting

54 User Guide

Page 55: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Improving Performance

Chapter 2: Operational Considerations 55

■ Statement Reporting

■ Plan/Package Utilities

Maintaining Objects

To maintain CA Plan Analyzer objects, use strategy services in the product to delete old strategies, and then REORG and image copy the tablespace.

Page 56: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 57: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 3: Maintaining Profiles

This section contains the following topics:

Global Profile (see page 57) Access the Profile Menu (see page 58) About Floating Point Format Notation (see page 60)

Global Profile This section describes the defaults which you can define for all of our products and, specifically, for the CA Plan Analyzer capabilities.

The Profile facility consists of the Global Profile and the CA Plan Analyzer Profile. Global Profile lets you specify profile values to apply to all of your DB2 products. The CA Plan Analyzer Profile lets you set variables that are specific to CA Plan Analyzer.

The global profile consists of several variables. Assigning values to the global profile variables let you:

■ Assign the SQL ID.

■ Specify the work unit for allocating temporary data sets.

■ Indicate the utilities you want to appear when using the DISPLAY UTILITIES command in the DB2 Command Processor.

■ Specify a symbolic variable replacement for Batch Processor data sets that are used at execution time.

■ Specify temporary DB2 and product load libraries for the Batch Processor.

■ Specify the parameter library to be generated and used with batch execution.

■ Specify the externalized message library to be generated and used with batch execution.

■ Specify JOB statement information.

■ Define print parameters.

■ Set panel colors for color monitors.

■ Select the language for products. English is the only option currently available.

Note: For more information about defining the global profile, see the General Facilities Reference Guide.

Chapter 3: Maintaining Profiles 57

Page 58: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Access the Profile Menu

Access the Profile Menu Use the Profile to specify values for parameters that are specific to CA Plan Analyzer. The available parameters include SQL defaults and mode defaults.

You can access the Profile Menu from the Main Menu or any CA Plan Analyzer command line.

To access the Profile Menu

1. Enter P in the command line and press Enter.

The Profile Menu appears.

PPPROF --------------- PPA Profile Menu --------------- OPTION ===> ---------------------------------------------------------------------- xxxxxx 1 - Global Profile Variables 2 - PPA Profile Variables

Note: To access the Profile Menu from anyCA Plan Analyzer panel, enter PROFILE (or PROF) in the command line and press Enter. The Profile Menu appears.

2. Enter 2 in the Option line and press Enter.

The Profile Variables panel appears.

PPPROF1 ------------ PPA Profile Variables ------------ COMMAND ===> General Execution Parameters: Qualifier ON/OFF default ===> N (Y=ON or N=OFF) Explode SQL ON/OFF default ===> Y (Y=Exploded or N=Shrunk) Strategy List Mode default ===> L (L=List versions ) (N=Do not list versions) Expert Mode default ===> N (Y=Expert, N=Regular) Display Batch Processor Input panel default ===> Y (Y or N) Package version(s) default ===> L (A=All, L=Latest version) Package versioning method ===> N (N=None, A=Auto, O=Creation) Package replace version default ===> Y (Y or N) Host Language default ===> ASM (ASM, COB, PLI, C, or SPF) Update Statistics Qualifier ===> SYSIBM Process Remote Packages ===> N (Y or N) Floating Point Format ===> SCI (SCI, ENG, or MET) Use New Report Layouts ===> Y (Y or N)

58 User Guide

Page 59: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Access the Profile Menu

3. To set CA Plan Analyzer profile variable values, enter the following values in the indicated fields. For fields that have a defined list of valid values, see the online help.

Qualifier ON/OFF Default

Indicate the initial object qualifier to use when you access Object Reporting. This field also determines the initial package qualifier setting when you access Statement Reporting or the Catalog Data panel from the Explain Strategy Services panel.

Explode SQL ON/OFF Default

Indicate the initial SQL display state for a new object dependency report or statement report.

Strategy List Mode Default

Indicate the default to use for showing strategy versions on the Explain Strategy Services panel.

Expert Mode Default

Select the mode that to use for explain processing.

Display Batch Processor Input panel Default

Indicate whether to see the Batch Processor Card Display panel. (This panel is a confirmation panel that shows the Batch Processor input before the input is executed.)

Package Versions Default

Indicate which versions of a package to show in CA Plan Analyzer.

Package Versioning Method

Indicate the package versioning method to use to compare the current explain package version source to a saved historical database hversion source (Strategy, Auto, Manual) during compare explain report processing in either quick explain or explain strategy. Valid values are:

■ N (None): The package versions must match exactly.

■ A (Auto): Use the DBRM Precompiler Timestamp (VERSION ID) sorted in descending to determine the correct package version. If you specify the precompiler option VERSION (AUTO) at DBRM precompile time, then the VERSION ID will be populated with a precompiler timestamp.

■ O (Creation): Use Package Create Timestamp sorted in descending order to determine correct package version.

Chapter 3: Maintaining Profiles 59

Page 60: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About Floating Point Format Notation

Package Replace Version Default

Indicate whether REPLVER is used during a BIND when a package is bound.

Note: For more information, see the IBM DB2 Command and Utility Reference Guide and DB2 Application Programming and SQL Guide.

Host Language Default

Indicate the default program language.

Update Statistics Qualifier

Specify the qualifier to use to limit the updating of catalog statistics for explain processing. The default is SYSIBM.

Process Remote Packages

Indicate whether to process remote packages.

Floating Point Format

Specify a format for floating point data. For more information, see About Floating Point Format Notation.

Use New Report Layouts

Specify whether to use the new report layouts for the Short Access Path, Short/Long SQL Dependency Analysis, and Short/Long Statistics reports. Valid values are:

■ Y: Use the report new layouts. This is the default.

■ N: Use the old report layouts.

4. Press PF3 (End) to save your selections.

The Profile Menu reappears.

About Floating Point Format Notation The following table shows equivalent notation among the three floating point format options.

Value Scientific English Metric

1,000

+0.1 E+04

1.0 THOU

1.0 KILO

1,000,000 +0.1 E+07 1.0 MILL 1.0 MEGA

1,000,000,000 +0.1 E+10 1.0 BILL 1.0 GIGA

1,000,000,000,000 +0.1 E+13 1.0 TRIL 1.0 TERA

1,000,000,000,000,000 +0.1 E+16 1.0 QUAD 1.0 PETA

60 User Guide

Page 61: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About Floating Point Format Notation

Chapter 3: Maintaining Profiles 61

Value Scientific English Metric

1,000,000,000,000,000,000

+0.1 E+19 1.0 QUIN 1.0 EXA

1,000,000,000,000,000,000,000

+0.1 E+22

1.0 SEXT

1.0 ZETT

1,000,000,000,000,000,000,000,000

+0.1 E+25 1.0 SEPT 1.0 YOTT

Note: For values that are equal to 1027 or greater, CA Plan Analyzer automatically shows the values in scientific notation, regardless of the Profile setting. Notice that no matter which notation option you use, the report value is the same.

Page 62: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 63: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 4: Understanding Current and Future Explains

This section contains the following topics:

Future Explains (see page 63) Current Explains (see page 64) Specifying the Explain Type (see page 66) Preparing Plans and Packages (see page 67)

Future Explains This section defines the types of explains available for Quick Explain and Explain Strategy Services.

CA Plan Analyzer offers two types of Enhanced Explains: one uses Future-type processing and the other uses Current-type processing. The Enhanced Explain types, Future and Current, apply to Quick Explain and Explain Strategy Services.

Note: The types do not correlate to the Enhanced Explain mode (Expert or Regular) you use. Your level of expertise with Plan Analyzer determines the Enhanced Explain mode you choose. For more information, see the CA Plan Analyzer Reference Guide.

A Future Explain executes a dynamic EXPLAIN command and then uses information from the DB2 Optimizer, catalog statistics, and CA Plan Analyzer Expert System Rules. The Future Explain tells you your access paths when you request a bind right now.

Chapter 4: Understanding Current and Future Explains 63

Page 64: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Current Explains

Benefits of Using a Future Explain

The advantages of using a Future Explain are:

Predicts impact

The Future Explain shows you the impact of rebinding a plan or package.

Explains for a test or production subsystem

You can perform Enhanced Explain processing on your production DB2 subsystem for a plan or package that resides on your test subsystem. This provides a method for tuning applications on your test subsystem before they are bound on your production subsystem. You can also explain your production plans and packages on a test subsystem.

Avoids REBINDs

A Future Explain does not require you to rebind your plans or packages to generate the Access path information if this information did not already exist. A rebind might adversely affect existing optimized paths.

Current Explains A Current Explain uses the information the DB2 Optimizer stored in the PLAN_TABLE (when the plan or package was last bound) with catalog statistics and Plan Analyzer Expert System Rules.

The owner of the plan or package is used as the creator for the PLAN_TABLE. For plans, the owner ID is obtained from the CREATOR column of SYSIBM.SYSPLAN. For packages, the owner ID is obtained from the OWNER column of SYSIBM.SYSPLAN.

The PLAN_TABLE contains information about plans and packages that have been bound with the EXPLAIN(YES) command.

64 User Guide

Page 65: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Current Explains

Benefits of Using a Current Explain

The benefits of using the Current type Explain are:

Improves Performance

A Current Explain processes faster than a Future Explain. It reduces contention on the catalog because CA Plan Analyzer does not have to execute a dynamic EXPLAIN command before generating the Explain results.

Increases Accuracy

The Current Explain is more accurate because it uses existing PLAN_TABLE information. By using the current PLAN_TABLE information, the Explain results reflect access path information for the Plans and Packages when they were bound.

Eliminates the limitation of the dynamic EXPLAIN command

The following details two limitations of the dynamic EXPLAIN command. The dynamic EXPLAIN command:

Uses parameter markers for host variables.

A dynamic EXPLAIN command must use parameter markers in place of all host variables. DB2 does not allow parameter markers in all the places where host variables are used. Therefore, CA Plan Analyzer must use other techniques to alter the SQL so you can process the EXPLAIN command. These changes could cause the optimizer to choose a different path. With the Current Explain, parameter markers are not used; therefore, alterations to the SQL are not necessary, and the access path shown in the Enhanced Explain output is accurate.

Assumes the attributes of the host variable are the same as those of the column.

When you use the dynamic EXPLAIN command, DB2 assumes the attributes of the host variable are the same as those of the column. For example, if a column of CHAR(5) is compared to a host variable defined in a COBOL program as PIC X(10), the predicate does not obtain the appropriate index access. Because the dynamic EXPLAIN command does not have information about the attributes of the host variable as defined in the COBOL program, a suitable index is not considered with the dynamic EXPLAIN command. DB2 assumes the attributes of the host variable match the attributes of the column. If the host variable is longer than the column, the index is not considered, but the dynamic EXPLAIN command masks the host variable and the index is considered.

Chapter 4: Understanding Current and Future Explains 65

Page 66: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying the Explain Type

Specifying the Explain Type After you have created a new strategy version or entered Y for Change Options on the Explain Strategy - Regular Mode panel, the Explain Options panel appears. Use this panel to specify the default values for enhanced explain processing.

PPESEO6 ---- PPA Explain Strategy - Explain Options ---- COMMAND ===> Strategy : TEST15 Type : E Creator : xxxxxx Share Option : U Version : VERS3 Description : TEST SCENARIO ---------------------------------------------------------------------- xxxxxx Database Options ===> Y Historical Database Options Primary AUTHID ===> Secondary AUTHID ===> Update SQL Qualifiers ===> Y (Override Schemas & SQL/View Qualifiers) Rule Set SSID ===> D71A (Subsystem where Rule Sets are stored) PLAN_TABLE Option ===> C (C - Commit, R - Rollback) Explain Type ===> F (C - Current, F - Future) Plan Explain Option ===> B (D - DBRM, P - Package, B - Both) Non-Catalog Isolation ===> CS Optimization Hint ===> XXXX Process Views (Y, N) ===> Y Parallelism Degree ===> Target SSID ===> D71A Target Rule Set ===> @DEFAULT Save Host Variables ===> Y Save Reports ===> Y Uppercase Output ===> Y Access Path Filters ===> N Reports ===> Y Search Conditions ===> N Catalog Statistics ===> N Search Filters ===> N Tie PERFORMANCE Data ===> N

Specify the type of Explain processing to use in the Explain Type field. Valid values are:

C

Process a Current Explain. For a Current Explain, the source and target SSIDs must match.

F

Process a Future Explain.

Note: For more information, see the CA Plan Analyzer Reference Guide. If SQL errors occur during a Current Explain, a special SQL code (@001 - @006) is returned. Code @007 can be returned if an error occurs during a Future Explain.

66 User Guide

Page 67: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Preparing Plans and Packages

Chapter 4: Understanding Current and Future Explains 67

Preparing Plans and Packages When you request a Current Explain, a bind with EXPLAIN(YES) must have been executed for all the plans or packages in the strategy to be Explained. You can use the Plan Analyzer facilities to help automate the binding of those plans or packages bound with EXPLAIN(NO). The following procedure explains how to prepare your plans or packages for a Current Explain.

Note: You must have selected the ISPF editor in your CA Plan Analyzer profile to complete the following procedure.

To prepare plans and packages for Current type Explain

1. Select the Identify Problem Plan/Packages option from the Main Menu.

Press Enter.

The Problem Plan/Packages Menu panel appears.

2. Enter selection criteria for a list of plans or packages and enter S for “Are bound with EXPLAIN(NO).”

Press Enter.

The Problem Plan (or Package) List panel appears.

3. Select the plans or packages you want bound using the line commands shown at the bottom of the panel.

Press Enter.

The Batch Processor Card Display panel appears.

The batch input for all plans or packages selected appears.

4. Enter EDIT in the command line to edit the batch input.

Press Enter.

The batch input appears in an edit session.

5. Enter the following in the command line:

CHANGE ALL 'EXPLAIN ( NO )' 'EXPLAIN ( YES )'

Press Enter.

Press PF3 (End) to return to the Batch Processor Display Card panel.

6. Press Enter to process the bind.

Note: For more information, see the CA Plan Analyzer Reference Guide.

After all the appropriate plans or package are bound, you are ready to process a Current Explain for your strategy.

Page 68: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 69: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 5: Using Quick Explain and Explain Strategy Services

This section contains the following topics:

Quick Explain and Explain Strategy Services (see page 69) Explaining SQL (see page 70) Choosing Explain Facilities (see page 76)

Quick Explain and Explain Strategy Services CA Plan Analyzer has two primary Explain facilities: Quick Explain and Explain Strategy Services. You can use either facility in Regular or Expert mode.

The Quick Explain facility quickly groups SQL sources for Explain processing. When you use Quick Explain, you cannot save your enhanced Explain reports. You view the Explain reports in the Batch Processor, and they are deleted as soon as you exit. However, Quick Explain does let you save a historical version of the source for your explain. You can access this historical version through the Source Database Maintenance facility.

The Explain Strategy Services facility provides a full range of options for your Explain processing. When you use Explain Strategy Services, the results of your Explain are saved and you can review them at any time. The strategy you created for the Explain is saved for re-execution in the future. You can also view and manipulate the historical version of your Explain through the Source Database Maintenance facility.

Chapter 5: Using Quick Explain and Explain Strategy Services 69

Page 70: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

Explaining SQL Plan Analyzer offers several options for explaining SQL. These options are:

Quick Explain

Explains one or more SQL sources using a minimum of panels and options.

Explain Strategy Services

Creates a strategy containing one or more SQL sources for Explain processing. You can save your strategy and review and update it at any time. You can create different versions of strategies to test differences in SQL or options.

Regular mode

Permits limited-feature, limited-option access to both Quick Explain and Explain Strategy Services.

Expert mode

Permits full access to Quick Explain and Explain Strategy Services and all their features.

Grouping of different SQL types

Groups different SQL source types for Explain processing in both Quick Explain and Explain Strategy Services.

SQL selection from catalog lists

Specifies SQL sources directly or choose them from catalog selection lists.

Definition of SQL sources based on selection criteria

Selects criteria to define SQL sources. This lets you create an Explain that encompasses a grouping of related SQL sources.

About Enhanced Explain

Enhanced explain describes the CA Plan Analyzer Quick Explain and Explain Strategy Services processing. CA Plan Analyzer starts with the basic DB2 explain process and enhances it.

Using only DB2, you can explain a single plan, a single package, or a single SQL statement. DB2 does not allow grouping plans, DBRMs, collections, packages, or SQL statements for explain processing.

70 User Guide

Page 71: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

With CA Plan Analyzer, you can logically group SQL sources for explain processing. For example, you can group all the plans in your payroll system into a single explain. You can also add DBRMs, collections, packages, queries, SQL statements, and file or library input to the same explain. You have the option of creating a Quick Explain using a minimum of screens and options. Or, you can use Explain Strategy Services to create a strategy of these grouped SQL sources. You can save, modify, and re-execute strategies at any time.

Enhanced explain output refers to any of the easy-to-read reports that are available with the CA Plan Analyzer enhanced explain processing. CA Plan Analyzer generates the enhanced explain reports according to your selections from the Reports screen. You can also generate these reports in batch. For more information, see the “Using Batch Reporting” chapter.

The following summarizes the available Enhanced Explain reports:

Summary

Shows which plans, collections, DBRMs, packages, and SQL statements have been explained, their types, and the EXPLAIN SQL code.

Cost

Displays how expensive an SQL statement is compared to other SQL statements.

Access

Explains in concise paragraphs how the SQL will be executed.

Short Access

Abbreviates the results from the Access Path report.

Predicate

Lists all predicates involved in the SQL and their indexability/sargability.

Short Predicate

Lists all predicates that are not both indexable and sargable.

Dependency

Shows which objects are dependent on an SQL statement.

Short Dependency

Abbreviates the results from the Dependency report.

SQLRULE

Indicates potential problems with SQL syntax and provides recommendations for improvement.

Chapter 5: Using Quick Explain and Explain Strategy Services 71

Page 72: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

PHYSRULE

Indicates potential problems with physical object design and provides recommendations for improvement.

PREDRULE

Indicates potential problems with SQL predicates and provides recommendations for improvement.

Performance

Displays performance data for packages, DBRMs, and their associated SQL statements.

Note: You must load performance data to view this report. For more information, see the appendix “Using Performance Data.”

PLANRULE

Displays the rules used to indicate potential problems with your plans or packages and offers recommendations.

Referential Integrity

Provides a visual reference of defined referential relationships.

Tree

Shows an indented tree diagram of referenced objects within the SQL.

Statistics

Displays the statistics reports in an easy-to-read hierarchical report based on statistics reports selected on the Statistics Report screen.

Compare

Compares historical versions of a variety of SQL sources, including those within CA Plan Analyzer strategies.

About Explain Modes

CA Plan Analyzer provides two operating modes for creating and executing your explain: regular and expert. Both modes let you specify multiple SQL sources for explain processing. You can use Quick Explain and Explain Strategy Services in either mode.

72 User Guide

Page 73: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

To designate an explain processing mode, complete the following steps:

1. Select Profile on the Main Menu. The Profile Menu appears.

After selecting PPA Profile Variables, the Profile Variables screen appears.

2. In Expert Mode default, enter Y for expert or N for regular mode.

Use this same method to switch modes. For more information, see the chapter “Maintaining Profiles.”

While using Quick Explain in regular mode, you can enter EXPERT on the command line to switch to expert mode. When you do this after entering source information in Quick Explain in regular mode, that source information is used to create an autobuild source entry on the Quick Explain Data Editor screen.

In general, the differences between the modes are:

■ Regular mode lets you create explains using a minimum of steps and screens. This mode supports only plans, plan/DBRM combinations, collection IDs, and collection ID/package combinations as SQL sources.

The Type field on the regular mode screens controls what CA Plan Analyzer explains.

The following table shows the relationships among the Type field on the regular mode screens, the SQL source types, and the CA Plan Analyzer processing routines:

Type Field SQL Source Type What Plan Analyzer Explains

P K Plan DBRM Coll.ID Package

X X Plans that match the names or selection criteria.

X X X Plan and DBRM combinations that match the names or selection criteria.

X X Collection IDs that match the names or selection criteria.

X X X Collection ID and package combinations that match the names or selection criteria.

Chapter 5: Using Quick Explain and Explain Strategy Services 73

Page 74: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

■ Expert mode offers maximum flexibility in customizing your explains. This mode supports all the SQL sources that regular mode supports. In addition, expert mode supports:

– DBRMs

– PRF queries and exported queries

– File input

– Packages

– QMF queries and exported queries

– DBRM library input

– SQL statements

– SQL dependent on a DB2 object

– SQL contained in a QMF query

About Quick Explain and Explain Strategy Services

CA Plan Analyzer has two primary explain facilities: Quick Explain and Explain Strategy Services. You can use either facility in regular or expert mode.

The Quick Explain facility lets you quickly group SQL sources for explain processing. When you use Quick Explain, you cannot save your enhanced explain reports. You view the explain reports in the batch processor, and they are deleted as soon as you exit. Quick Explain does, however, let you save a historical version of the source for your explain. You can access this historical version through the Source Database Maintenance facility.

The Explain Strategy Services facility provides a full range of options for your explain processing. When you use Explain Strategy Services, the results of your explain are saved and you can review them at any time. The strategy you created for the explain is also saved for re-execution at any future time. You can also view and manipulate the historical version of your explain through the CA Plan Analyzer Source Database maintenance facility.

74 User Guide

Page 75: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explaining SQL

About Strategy Versions and Historical Versions

CA Plan Analyzer saves the strategies you create in Explain Strategy Services to a strategy table. When you explain a strategy, a version or copy of the enhanced explain output is saved to the strategy table. Strategy versions let you analyze and compare how SQL affects optimization and access paths. You can create strategy versions in both regular and expert modes.

Note: Versions are not created when you use the EXPLAIN primary command. The CA Plan Analyzer Compare Explain Versions feature compares historical versions, which might or might not be directly equivalent to strategy versions.

When you use the CA Plan Analyzer Explain Strategy Services, versions of the strategies you explain are saved to the CA Plan Analyzer historical database. Each time you execute an explain, however, a historical version of that explain SQL source is saved to the CA Plan Analyzer historical database, even when you have used Quick Explain.

The historical version always contains the information used to perform the explain but contains enhanced explain reports only when you use Explain Strategy Services and the explain options are set to save the reports.

The historical database that contains these CA Plan Analyzer historical versions also contains historical versions from two other products: CA Index Expert and CA Detector. While you can view and manipulate historical versions from CA Index Expert and CA Detector using the CA Plan Analyzer Source Database Maintenance facility, these historical versions must be explained in Quick Explain or Explain Strategy Services before they can be used as SQL sources for the CA Plan Analyzer Query Explain Database, Compare Explain Versions, and Identify Problem SQL features.

Note: For more information, see the chapters “Maintaining Stored Procedures,” “Querying the Explain Database,” “Comparing Explain Versions,” and “Identifying Problem SQL.”

About Tuning Performance With Optimization Hints

Optimization hints provide a way for users to influence or override the access path used by the DB2 optimizer for a particular query. In brief, you can indicate what access path the optimizer should use by referencing PLAN_TABLE information as input. This is helpful in situations where, for example, a specific response time must be maintained.

The PLAN_TABLE rows which describe a desirable access path are set to contain an identifier (the hint ID) in the OPTHINT column. When a plan or package is rebound, with bind option OPTHINT set to the desired hint ID, its presence triggers the optimizer to read the access path information kept in the corresponding PLAN_TABLE row.

Chapter 5: Using Quick Explain and Explain Strategy Services 75

Page 76: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

After a hint has been used successfully, the HINT_USED column in PLAN_TABLE is updated to reflect that hint ID. If no optimization hint has been specified (the Optimization Hint field is blank by default), DB2 uses normal optimization.

CA Plan Analyzer supports the use of optimization hints in Explain Strategy Services, as well as in the BIND and REBIND utilities. The options screens in the corresponding sections of the product contain a field (Optimization Hint) for input of the hint ID.

Note: Hints should only be used after trying typical optimization and other tuning techniques. For detailed information about how to create optimization hints, see your IBM DB2 documentation.

Choosing Explain Facilities CA Plan Analyzer offers many choices for explain processing. As a rule, working in regular mode is faster than working in expert mode, and working in Quick Explain is faster than working in Explain Strategy Services. However, the type of objects you are working with and the type of analysis you want to perform often dictate the mode or the type of explain you must use.

Use the following table to determine which mode and which facility to use. The last three columns suggest which facility and mode to use.

SQL Source Type Save Explain data?

Save reports?

Quick Explain

Explain Strategy Services

Regular Expert

Plans; plan/DBRM combinations

N/A N/A X N/A X N/A

N/A X X N/A N/A N/A

N/A X X N/A N/A N/A X

Collection ID; collection ID/package combinations

N/A N/A X N/A N/A X

N/A X N/A X N/A N/A X

76 User Guide

Page 77: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Chapter 5: Using Quick Explain and Explain Strategy Services 77

SQL Source Type Save Explain data?

Save reports?

Quick Explain

Explain Strategy Services

Regular Expert

DBRM; package; SQL statement; PRF query and exported query; QMF query and exported query; file input; DBRM library input; SQL dependent on a DB2 object; SQL contained in a QMF query

X N/A X N/A N/A X

Procedures for Quick Explain in Regular Mode

The CA Plan Analyzer Quick Explain feature lets you explain one or more SQL sources using a minimum of panels and options.

Accessing the Quick Explain Facility

To use the Quick Explain facility in regular mode, you must set your CA Plan Analyzer profile to use regular mode and select the Quick Explain menu option.

To access Quick Explain in regular mode

1. On the Profile Variables screen, enter N for Expert Mode default.

For details, see the About Explain Modes section.

2. Press Enter.

CA Plan Analyzer saves the change.

3. Press PF3 (End) twice.

The Main Menu appears.

4. On the Main Menu, enter 1 on the command line and press Enter.

The Quick Explain screen appears.

Page 78: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Specifying Criteria for an Explain

You can use this procedure to specify criteria for an explain on the Quick Explain panel.

To specify criteria for an Explain

1. Enter values in the indicated fields.

For fields that have a defined list of valid values, see the online help.

Type

Indicate whether to explain plans or packages.

■ Plan/Collid and DBRM/Package-When you want to explain plans, indicate the name of a plan and, optionally, the name of a DBRM. You can use selection criteria in these fields.

■ When you want to explain packages, indicate a collection ID and the name of a package. You can use selection criteria in these fields.

■ Selection List-If you entered selection criteria in Plan/Collid or DBRM/Package, indicate whether to display a selection list or execute the explain for every plan or package that meets the selection criteria.

■ Change Options-Indicate whether to change the explain options.

■ Profile-(Optional) When you have created and want to use an explain profile, specify the name of the profile. To display a selection list, enter a question mark (?). See the Selecting an Explain Profile section for more information.

Press Enter.

When you specify selection criteria, the appropriate screens appear. See the following sections for procedures:

■ Selecting an Explain Profile.

■ Selecting Objects to Explain.

■ Specifying Explain Options.

Otherwise, the Batch Processor Card Display screen appears.

2. (Optional) To continue, see the procedure described in "Executing an Explain."

78 User Guide

Page 79: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Selecting an Explain Profile

If you enter a question mark (?) for Profile on the Quick Explain panel, the Explain Profile Selection List panel appears. One this panel, you must select an explain profile to use. For more information, see the chapter "Maintaining the Plan Table."

To select an explain profile

1. Enter S in the line command field next to the explain profile you want to use.

2. Press Enter.

Selecting Objects to Explain

If you enter selection criteria for Plan/Collid or DBRM/Package and enter Y in Selection List on the Quick Explain panel one of the following panels appears:

■ Quick Explain Plan Catalog Data panel

■ Quick Explain Package Catalog Data panel

To select objects to explain on either panel

1. Enter S in the line command fields next to the names of the objects you want to explain.

2. Press Enter.

A message indicating that the selected objects have been queued appears.

3. (Optional) Repeat steps 1 and 2 to select additional objects.

4. (Optional) Enter S on the command line and press Enter.

The Data Queue panel with a list of all the objects you selected. For more information, see Managing Selection Lists.

5. Press PF3 (End).

Chapter 5: Using Quick Explain and Explain Strategy Services 79

Page 80: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Specifying Explain Options

If you set the Change Options field on the Quick Explain panel to Y, the Quick Explain - Explain Options panel appears.

To specify explain options on the Quick Explain – Explain Options panel

1. Enter values in the indicated fields.

For fields that have a defined list of valid values, see the online help.

Database Options

Indicate whether you want to change the historical database options.

Primary AUTHID and Secondary AUTHID

Indicate the primary and secondary authorization IDs, respectively.

Update SQL Qualifiers

Indicate whether to override schemas and SQL qualifiers for tables and views.

Rule Set SSID

Indicate the ID of the DB2 subsystem where the rule set you want to use is stored.

PLAN_TABLE Option

Indicate whether to commit or roll back changes made to the PLAN_TABLE and DSN_STATEMNT_TABLE.

Explain Type

Indicate the type of explain processing to use.

Plan Explain Option

Indicate whether to explain only the DBRMs, only the packages, or both the DBRMs and packages in the plans in the explain.

Non-Catalog Isolation

Indicate the isolation method to be used during explain processing for Non-Catalog SQL sources.

Process Views

Indicate whether to process views during explain processing.

Parallelism Degree

Indicate the degree of parallelism to use during explain processing.

80 User Guide

Page 81: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Target SSID

Indicate the subsystem ID to be used for unspecified target subsystems. The default is the current subsystem ID.

Target Rule Set

Indicate the name of the rule set to use for unspecified rule sets. By default, this field is blank.

Uppercase Output

Indicate whether to generate reports in all uppercase or both upper and lower case.

Access Path Filters

Indicate whether to view, ignore, or change access path filters.

Reports

Indicate whether to view, change, or ignore report options.

Search Conditions

Indicate whether to view, ignore, or change search condition options.

Catalog Statistics

Indicate whether to view, change, or ignore catalog statistics for the explain.

Search Filters

Indicate whether to view, ignore, or change search filter options.

Tie Performance Data

Indicate whether to link the explain to the performance data for the objects.

Note: You must have performance data loaded into the CA Plan Analyzer database to use this feature. For more information, see the “Using Performance Data” appendix.

Optimization Hint

Specify the hint ID to use during explain processing.

2. Press Enter.

Various panels display, depending on your explain option specifications:

■ When you change the historical database options, the Historical Database Options panel appears. Complete the steps in the Specifying Historical Database Options section.

■ When you change SQL qualifiers for tables and views, the Quick Explain SQL Qualifiers panel appears. Complete the steps in the Specifying SQL Qualifiers section.

Chapter 5: Using Quick Explain and Explain Strategy Services 81

Page 82: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

■ When you change report options, the Quick Explain Reports panel appears. Complete the steps in the Specifying Report Options section.

■ When you change search condition options, the Quick Explain Search Conditions panel appears. Complete the steps in the Specifying Search Conditions section.

■ When you change catalog statistics for the explain, complete the steps in the Changing Catalog Statistics section.

■ When you change access path filters, the Quick Explain Access Path Filters panel appears. Complete the steps in the Specifying Access Path Filters section.

■ When you change search filter options, the Quick Explain Filters panel appears. Complete the steps in the Specifying Search Filter Options section.

■ When the conditions in the preceding points do not apply (or when you have completed the preceding points), the Quick Explain - Explain Options panel appears.

3. (Optional) To save the current explain options as defaults, enter SAVE on the command line and press Enter.

CA Plan Analyzer saves the options as defaults and a confirmation message appears.

4. Press PF3 (End).

The Batch Processor Card Display panel appears.

Executing an Explain

Complete this procedure after you have specified criteria for the objects to explain. You can execute an Explain in online, batch, or immediate batch mode.

To execute an Explain in online mode

1. Enter O in the Mode field on the Batch Processor Card Display panel.

Press Enter.

CA Plan Analyzer submits the batch input, a wait panel appears, and then the results of the execution are shown on the AUDIT Message File panel.

2. Review the execution messages.

Based on the analysis of the selected reports for the Explain execution, proceed accordingly.

3. Press PF3 (End) to exit.

The user is returned to the Quick Explain facility.

82 User Guide

Page 83: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

To execute an Explain in batch mode

1. Enter B in the Mode field on the Batch Processor Card Display panel.

Press Enter.

The Batch Specification panel appears.

2. Enter values in the indicated fields.

Press Enter.

For fields that have a defined list of valid values, see the online help.

The Batch Processor allocates and opens the specified data set. You are returned to the previous panel and an informational message appears indicating that the data set has been allocated.

Note: To execute the data set you created, enter the BP command to initiate the Batch Processor. For more information, see the Batch Processor Reference Guide. For additional information about reporting in batch mode, see the chapter “Using Batch Reporting.”

To execute an Explain in immediate batch mode

1. Enter I in the Mode field on the Batch Processor Card Display panel and press Enter.

The Batch Processor Immediate Batch panel appears.

2. Enter values in the indicated fields.

Press Enter.

For fields that have a defined list of valid values, see the online help.

Depending on the value you specified in the Option field, one of the following occurs:

■ If you specify S, the Batch Processor input is submitted to JES.

■ If you specify E, the Batch Processor input displays in an edit session. After you modify the input, press PF3 (End) to save the changes and redisplay the Batch Processor Immediate Batch panel. Return to step 1.

■ If you specify D, the Batch Reporting Dataset Selection panel appears. Continue with step 3.

3. Enter values in the indicated fields.

Press Enter.

For fields that have a defined list of valid values, see the online help.

Chapter 5: Using Quick Explain and Explain Strategy Services 83

Page 84: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

The Batch Processor allocates and opens the specified data set. You are returned to the previous panel and a message appears indicating that the data set has been allocated.

Note: To execute the data set you created, enter BP to initiate the Batch Processor. For more information, see the Batch Processor Reference Guide. For additional information about reporting in batch mode, see the chapter “Using Batch Reporting.”

Procedures for Quick Explain in Expert Mode

To use the Quick Explain facility in expert mode, you must set your CA Plan Analyzer profile to use expert mode and select the Quick Explain menu option.

To access Quick Explain

1. On the Profile Variables panel, enter Y for Expert Mode default.

For details, see About Explain Modes.

2. Press Enter to save the changes.

3. Press PF3 (End) twice.

The Main Menu appears.

4. Enter 1 on the command line and press Enter.

The Quick Explain Data Editor panel appears.

Creating SQL Source Entries

In expert mode, you can explain more SQL source types than in regular mode. Before you can explain them, you must define them to CA Plan Analyzer. This process is called creating SQL source entries. You can create an SQL source entry in one of three ways:

■ Create a new entry by entering values on the Quick Explain Data Editor panel

■ Edit a copy of an existing entry

■ Copy an existing entry

84 User Guide

Page 85: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Creating a New SQL Source Entry

You can use this procedure to create a new SQL source entry.

To create a new SQL source entry

1. (Optional) After you create an explain profile, specify the name of the explain profile in Profile.

To display a selection list, enter a question mark (?).

2. In the create line, enter values in the indicated fields.

For fields that have a defined list of valid values, see online help.

C

Enter C.

TY

Indicate the type of SQL source.

TARGET SSID

Indicate the ID of the DB2 subsystem on which the explain should take place.

TARGET RULE SET

Indicate which rule set to use to evaluate the SQL statements.

OP

Indicate whether to use or update source options. (Source options override explain options.)

LOCATION

Indicate the location of the SQL source.

SSID

Indicate the ID of the DB2 subsystem on which the source object resides.

PLAN/COLLID

Indicate the name of the plan or collection ID for the SQL source. Selection criteria are accepted.

DBRM/PACKAGE

Indicate the name of the DBRM or package for the SQL source. Selection criteria are accepted.

STMT

(Optional) Indicate the number of the specific SQL statement you want to explain. This field is valid only for plan and package source types.

Chapter 5: Using Quick Explain and Explain Strategy Services 85

Page 86: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

3. Repeat step 2 (or complete the procedure described in Editing an Existing Entry or Copying an Existing Entry) to create additional SQL source entries.

4. Press Enter.

Various panels display, depending on the values you specified.

If you are using selection criteria in the previous fields, see the next sections to complete the panels that display:

■ Selecting an Explain Profile.

■ Selecting Objects to Explain.

■ Specifying Source Options.

Otherwise, go to Executing an Explain.

Selecting an Explain Profile

When you enter a question mark (?) for Profile, the Explain Profile Selection List panel appears. On this panel, select an Explain profile to use. For more information about Explain profiles, see the chapter “Maintaining the Plan Table.”

To select an Explain profile, enter S in the line command field of the Explain Profile Selection List panel next to the Explain profile to use and press Enter. The selected Explain profile name is inserted into the Profile field.

Specifying Source Options

When you enter Y or U in OP for a new or existing SQL source entry, the Quick Explain - Source Options panel appears. Use this panel to select options to override any specified Explain options.

To specify source options, enter values in the indicated fields and press Enter. For fields that have a defined list of valid values, see the online help.

Various panels appear, depending on the chosen values:

■ When you enter Y in Database Options, the Historical Database Options panel appears. Complete the procedure described in Specifying Historical Database Options.

■ When you enter Y in Reports, the Reports panel appears. Complete the procedure described in Specifying Report Options.

■ When you enter Y in Catalog Statistics, complete the procedure described in Changing Catalog Statistics.

■ When you enter Y in Search Conditions, the Search Conditions panel appears. Complete the procedure described in Specifying Search Conditions.

86 User Guide

Page 87: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

■ When you enter Y in Access Path Filters, the Access Path Filters panel appears. Complete the procedure described in Specifying Access Path Filters.

■ When you enter Y in Filters, the Filters panel appears. Complete the procedure described in Specifying Search Filter Options.

■ When the preceding conditions do not apply (or when you have completed the preceding conditions), the Quick Explain- Source Options panel appears.

Selecting Objects to Explain

When you enter selection criteria in Plan/Collid or DBRM/Package, the Catalog Data panel appears. On the Catalog Data panel, you must select one or more objects to include in the explain.

To select sources from a catalog list

1. On the Catalog Data panel, enter S in the line command fields next to the names of the objects you want to explain.

2. Press Enter.

A message displays indicating that the selected objects have been queued.

3. (Optional) Repeat steps 1 and 2 to select additional objects.

4. (Optional) Enter S on the command line and press Enter.

The Data Queue screen appears with a list of all the objects you selected. For more information, see Managing Selection Lists.

5. Press PF3 (End).

The Quick Explain Data Editor panel appears.

Editing an Existing Entry

You can use this procedure to edit an existing entry.

To edit an existing entry

1. Create at least one SQL source entry using the procedure described in Creating a New SQL Source Entry.

2. In C, next to the existing SQL source entry that you want to copy, enter R.

3. Press Enter.

A copy of the SQL source entry is added to the displayed list.

4. Make changes to the field values in the SQL source entry you copied.

For more information, see the online help.

5. Press Enter.

CA Plan Analyzer saves your changes

Chapter 5: Using Quick Explain and Explain Strategy Services 87

Page 88: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Copying an Existing Entry

You can copy an existing SQL source entry by completing the following procedure.

To copy an existing entry

1. Create at least one SQL source entry using the procedure described in Creating a New SQL Source Entry.

Various panels appear, depending on the specified values.

2. Enter O next to the SQL source entry that has the options to copy.

3. Specify information for a new SQL source in the Create line.

Press Enter.

For more information, see Creating SQL Source Entries. The SQL source entry is created and added to the list.

Editing SQL Source Entries

To edit the information you entered for an SQL source entry, clear the values that appear for an entry on the Quick Explain Data Editor panel and enter new ones. If you choose to update the source options, see Specifying Source Options.

Deleting SQL Source Entries

Use the D line command to delete one or more SQL source entries from the list displayed on the Quick Explain Data Editor screen.

To delete an SQL source entry

1. On the Quick Explain Data Editor screen, enter D in the line command fields next to the SQL source entries that you want to delete.

2. Press Enter.

The SQL source entries are removed from the list.

Executing an Explain

Complete this procedure after creating SQL source entries for the Explain.

To execute an Explain

1. Press PF3 (End) on the Quick Explain Data Editor panel.

The Quick Explain- Explain Options panel appears.

88 User Guide

Page 89: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

2. Specify the Explain options by entering values in the indicated fields. For fields that have a defined list of valid values, see the online help.

Database Options

Indicate whether to change the historical database options.

Primary AUTHID and Secondary AUTHID

Indicate the primary and second authorization IDs.

Update SQL Qualifiers

Indicate whether to use, update, or ignore schemas and SQL qualifiers for tables and views.

Rule Set SSID

Indicate the ID of the DB2 subsystem where the rule set to use is stored.

PLAN_TABLE Option

Indicate whether to commit or rollback changes made to the PLAN_TABLE and DSN_STATEMNT_TABLE.

Explain Type

Indicate the type of Explain processing to use.

Plan Explain Option

Indicate whether to explain only the DBRMs, only the packages, or both in the Explain plans.

Non-Catalog Isolation

Indicate the isolation method to use during Explain processing for Non-Catalog SQL sources.

Process Views

Indicate whether to process views during Explain processing.

Parallelism Degree

Indicate the degree of parallelism to use during Explain processing.

Target SSID

Indicate the subsystem ID to use for unspecified target subsystems. The default is the current subsystem ID.

Target Rule Set

Indicate the name of the rule set to use for unspecified rule sets. The default for this field is blank.

Chapter 5: Using Quick Explain and Explain Strategy Services 89

Page 90: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Uppercase Output

Indicate whether to generate reports in all uppercase or both upper and lower case.

Access Path Filters

Indicate whether to view, ignore, or change access path filters.

Reports

Indicate whether to view, ignore, or change report options.

Search Conditions

Indicate whether to view, ignore, or change search condition options.

Catalog Statistics

Indicate whether to view, ignore, or change catalog statistics for the Explain.

Search Filters

Indicate whether to view, ignore, or change search filter options.

Optimization Hint

Indicate what access path the optimizer uses by referencing PLAN_TABLE information as input.

Tie Performance Data

Indicate whether to link the Explain to the performance data for the objects.

Note: You must have loaded performance data into the Plan Analyzer database to use this feature. For more information, see the appendix, "Using Performance Data."

Press Enter.

If you changed Explain options, various panels appear:

■ When you change the historical database options, the Historical Database Options panel appears. Complete the steps in Specifying Historical Database Options.

■ When you change SQL qualifiers for tables and views, the Quick Explain SQL Qualifiers panel appears. Complete the steps in Specifying SQL Qualifiers.

■ When you change report options, the Quick Explain Reports panel appears. Complete the steps in Specifying Report Options.

■ When you choose to change catalog statistics for the Explain, complete the steps in Changing Catalog Statistics.

90 User Guide

Page 91: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

■ When you change search condition options, the Quick Explain Search Conditions panel appears. Complete the steps in Specifying Search Conditions.

■ When you change access path filters, the Quick Explain Access Path Filters panel appears. Complete the steps in Specifying Access Path Filters.

■ When you change search filter options, the Quick Explain Filters panel appears. Complete the steps in Specifying Search Filter Options.

If you have not made any option changes or when you have completed all changes, the Quick Explain- Explain Options panel appears. Continue with step 4.

3. (Optional) Enter SAVE on the command line to save the current Explain options as defaults.

Press Enter.

Plan Analyzer saves the options as defaults and a confirmation message appears.

4. Press Enter.

The Batch Processor Card Display panel appears.

Continue with one of the procedures described in the Executing an Explain section of Procedures for Quick Explain in Regular Mode.

Procedures for Explain Strategy Services in Regular Mode

To use the Explain Strategy Services facility in regular mode, you must set your CA Plan Analyzer profile to use regular mode and select the Explain Strategy Services menu option.

Note: Before using Explain Strategy Services, be sure to understand the differences among strategies, strategy versions, and historical versions. For more information, see Explaining SQL.

To select regular mode

1. Access the Profile Variables panel.

For more information, see About Explain Modes.

2. In Expert Mode default, enter N.

3. Press Enter.

CA Plan Analyzer saves the change.

Chapter 5: Using Quick Explain and Explain Strategy Services 91

Page 92: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

4. Press PF3 (End) twice.

The Main Menu appears.

5. Enter 2 on the command line and press Enter.

The Explain Strategy Services panel appears.

Creating a Strategy

Explain Strategy Services use strategies to maintain information about Explain processing for the selected SQL sources. Before you can perform any Explain processing, you must create a strategy.

To create a strategy

1. Access Explain Strategy Services in Regular mode.

For more information, see Designate an Explain Processing Mode.

2. Enter information in the fields of the Create line of the Explain Strategy Services panel.

Press Enter.

For fields that have defined lists of valid values, see the online help.

The Explain Strategy- Regular Mode panel appears.

Line Command field

Enter C.

STRATEGY/VERSION

Enter a name for the strategy.

DESCRIPTION

(Optional) Enter a description for the strategy.

SO

Indicate the share option for the strategy.

92 User Guide

Page 93: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

3. Enter values in the indicated fields.

For fields with defined lists of valid values, see the online help.

Share Option

(Optional) Change the share option of the strategy by clearing the value that appears and entering a new value.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the Plan Analyzer parmlib. To see a selection list, enter a question mark (?). For more information about Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

Description

(Optional) Change the description of the strategy by clearing the value that appears and entering a new value.

Location

Specify the location of the SQL sources to explain. The default is LOCAL. To display a selection list, enter a question mark (?).

DB2 SSID

Specify the ID of the DB2 subsystem for the SQL sources to explain. To display a selection list, enter a question mark (?).

Target SSID

Specify the ID of the DB2 subsystem where the Explain will occur. To display a selection list, enter a question mark (?).

Type

Indicate whether to explain plans or packages.

Plan/Collid

To explain plans, indicate the name of a plan and a collection ID. Selection criteria are accepted in these fields.

DBRM/Package

(Optional) The name of a DBRM. Selection criteria are accepted in these fields.

Plan/Collid and DBRM/Package

To explain packages, indicate the name of a package and a collection ID. Selection criteria are accepted in these fields.

Chapter 5: Using Quick Explain and Explain Strategy Services 93

Page 94: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Selection List

If you entered selection criteria in Plan/Collid or DBRM/Package, indicate whether to show a selection list or execute the Explain for every plan or package that meets the selection criteria.

Change Options

Indicate whether to change the Explain options.

Press Enter.

Depending on your choices, various panels appear.

If you used selection criteria, see the next four sections to complete the panels that appear:

■ Select an Explain Profile

■ Select Locations

■ Select Objects to Explain

■ Specify Explain Options

Otherwise, continue with step 4.

4. Perform one of the following:

■ To save the strategy for further updates or processing, press PF3 (End).

The Explain Strategy Services panel appears.

■ To switch to Expert mode, enter EXPERT on the command line and press Enter.

The Explain Services Data Editor panel appears with any specified strategy information. For more information, see Explain Strategy Services in Expert Mode.

■ To perform an Explain, complete the procedure described in Execute an Explain.

Selecting an Explain Profile

If you enter a question mark (?) for Profile on the Quick Explain panel, the Explain Profile Selection List panel appears. One this panel, you must select an explain profile to use. For more information, see the chapter "Maintaining the Plan Table."

To select an explain profile

1. Enter S in the line command field next to the explain profile you want to use.

2. Press Enter.

94 User Guide

Page 95: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Selecting Locations

When you enter a question mark (?) in Location, DB2 SSID or Target SSID, the DB2 SSID/Location Selection panel appears.

Note: For more information, see the General Facilities Reference Guide.

Selecting Objects to Explain

When you enter selection criteria in Plan/Collid or DBRM/Package field and enter Y in Selection List, one of the following panels displays:

■ Explain Strategy Plan Catalog Data screen

■ Explain Strategy Package Catalog Data screen

On either panel, you must select one or more objects to include in the explain.

To select objects to explain

1. On the Catalog Data panel, enter S in the line command fields next to the names of the objects you want to explain.

2. Press Enter.

A message displays indicating that the selected objects have been queued.

3. (Optional) Repeat steps 1 and 2 to select additional objects.

4. (Optional) Enter S on the command line and press Enter.

The Data Queue panel displays with a list of all the objects you selected. For more information, see Managing Selection Lists.

5. Press PF3 (End).

Specify Explain Options

Use the Explain Strategy-Explain Options panel to specify the Explain options for the strategy.

To specify Explain options

1. On the Explain Strategy-Explain Options panel, enter values in the indicated fields. For fields that have a defined list of valid values, see the online help.

Database Options

Indicate whether to change the historical database options.

Primary AUTHID and Secondary AUTHID

Indicate the primary and second authorization IDs.

Chapter 5: Using Quick Explain and Explain Strategy Services 95

Page 96: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Update SQL Qualifiers

Indicate whether to use, update, or ignore schemas and SQL qualifiers for tables and views.

Rule Set SSID

Indicate the ID of the DB2 subsystem where you want to store the rule set.

PLAN_TABLE Option

Indicate whether to commit or rollback changes made to the PLAN_TABLE and DSN_STATEMNT_TABLE.

Explain Type

Indicate the type of Explain processing to use.

Plan Explain Option

Indicate whether to explain only the DBRMs, only the packages, or both in the Explain plans.

Non-Catalog Isolation

Indicate the isolation method to use during Explain processing for Non-Catalog SQL sources.

Process Views

Indicate whether to process views during Explain processing.

Parallelism Degree

Indicate the degree of parallelism to use during Explain processing.

Target SSID

Indicate the subsystem ID to use for unspecified target subsystems. The default is the current subsystem ID.

Target Rule Set

Indicate the name of the rule set to use for unspecified rule sets. The default is a blank.

Uppercase Output

Indicate whether to generate reports in all uppercase or both upper and lower case.

Save Reports

Indicate whether to save the reports generated during Explain processing.

Save Host Variables

Indicate whether to save host variable data for later use in the Compare Explain Versions facility.

96 User Guide

Page 97: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Access Path Filters

Indicate whether to view, ignore, or change access path filters.

Reports

Indicate whether to view, ignore, or change report options.

Search Conditions

Indicate whether to view, ignore, or change search condition options.

Catalog Statistics

Indicate whether to view, ignore, or change catalog statistics for the Explain.

Search Filters

Indicate whether to view, ignore, or change search filter options.

Optimization Hint

Indicate what access path the optimizer uses by referencing PLAN_TABLE information as input.

Tie Performance Data

Indicate whether to link the Explain to the performance data for the objects.

Note: You must have loaded performance data into the Plan Analyzer database to use this feature. For more information, see the appendix, "Using Performance Data."

Press Enter.

■ When you change the historical database options, the Historical Database Options panel appears. Complete the procedure described in Specifying Historical Database Options.

■ When you change SQL qualifiers for tables and views, the Quick Explain SQL Qualifiers panel appears. Complete the steps in Specifying SQL Qualifiers.

■ When you change report options, the Quick Explain Reports panel appears. Complete the steps in Specifying Report Options.

■ When you change catalog statistics for the Explain, complete the steps in Changing Catalog Statistics.

■ When you change search condition options, the Quick Explain Search Conditions panel appears. Complete the steps in Specify Search Conditions.

■ When you change access path filters, the Quick Explain Access Path Filters panel appears. Complete the steps in Specify Access Path Filters.

Chapter 5: Using Quick Explain and Explain Strategy Services 97

Page 98: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

■ When you change search filter options, the Quick Explain Filters panel appears. Complete the steps in Specify Search Filter Options.

■ When the preceding conditions do not apply (or when you have completed the preceding conditions), the Explain Strategy- Explain Options panel appears. Continue with step 2.

2. (Optional) Enter SAVE on the command line to save the current Explain options as defaults.

Press Enter.

Plan Analyzer saves the options as defaults and a confirmation message appears.

3. Press PF3 (End).

CA Plan Analyzer saves the Explain option settings. Depending on where the user entered the Explain Options panel, the user is returned to the appropriate panel.

Executing an Explain

Explain Strategy Services lets you execute an Explain during strategy creation and after saving a strategy. Use the EXPLAIN primary command to execute an Explain without saving the output. Use the E line command to execute an Explain and save the output.

To execute an Explain during strategy creation

1. Enter EXPLAIN on the command line of the Explain Services Data Editor panel.

Press Enter.

The Explain Strategy - Explain Options panel appears.

2. Update the values on this panel as necessary.

Press Enter.

For more information, see Specify Explain Options.

The Batch Processor Card Display panel appears.

Continue with one of the procedures described in How to Perform a Quick Explain in Regular Mode.

98 User Guide

Page 99: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

To explain a saved strategy

1. Enter E in the line command fields of the Explain Strategy Services panel next to the strategies to explain.

Press Enter.

The Version Info panel appears.

2. Enter values in the indicated fields.

For fields that have defined lists of valid values, see the online help.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the CA Plan Analyzer parmlib. To display a selection list, enter a question mark (?). For more information about Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

Identifier

Enter a name for the new strategy version, or to use a system-generated identifier, leave the Identifier field blank.

Description

Enter a description of the new strategy version.

Replace Existing Version

Indicate whether to replace an existing version that has the same name that you specified in the Identifier field.

Update Explain Options

Indicate whether to update Explain options.

Press Enter.

One of the following occurs:

■ If you enter a question mark (?) for Profile, the Explain Profile Selection List panel appears. Continue with step 3.

■ If you are updating Explain options, the Explain Strategy - Explain Options panel appears. Continue with step 4.

■ If neither of these conditions apply, the Batch Processor Card Display panel appears. Continue with step 5.

Chapter 5: Using Quick Explain and Explain Strategy Services 99

Page 100: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

3. Enter S in the line command field of the Explain Profile Selection List panel next to the Explain profile to use.

Press Enter.

The Version Info panel appears with a message indicating that Explain profile options will be used during Explain processing.

■ To override options from the Explain profile, continue with step 4.

■ To use the Explain profile without overrides, skip to step 5.

4. Update the values as necessary on the Explain Strategy - Explain Options panel.

Press Enter.

The Batch Processor Card Display panel appears.

For more information, see the Specifying Explain Options section.

Continue with one of the procedures described in How to Perform a Quick Explain in Regular Mode.

Update a Strategy

Use the U line command to update a saved strategy.

To update a strategy

1. Enter U in the line command field of the Explain Strategy Services panel next to the strategy to be updated.

Press Enter.

The Explain Strategy - Regular Mode panel appears with the existing data for the strategy.

2. Enter changes to the fields on this panel.

Share Option

(Optional) Change the share option of the strategy by clearing the value that appears and entering a new value.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the CA Plan Analyzer parmlib. To display a selection list, enter a question mark (?). For more information on Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

100 User Guide

Page 101: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Description

(Optional) Change the description of the strategy by clearing the value that appears and entering a new value.

Location

Indicate the location of the SQL source to explain. The default is LOCAL. For a selection list, enter a question mark (?).

DB2 SSID

Indicate the ID of the DB2 subsystem for the SQL sources to explain. For a selection list, enter a question mark (?).

Target SSID

Specify the ID of the DB2 subsystem where you want the Explain to take place. For a selection list, enter a question mark (?).

Type

Indicate whether to explain plans or packages.

PLAN/COLLID

Indicate the name of the plan or collection ID to explain. Selection criteria are accepted in these fields.

DBRM/PACKAGE

(Optional) Specify the name of the DBRM. Selection criteria are accepted in these fields.

Plan/Collid and DBRM/Package

Indicate a collection ID and the name of the package to explain. Selection criteria are accepted in these fields.

Selection List

Indicate whether to show a selection list or execute the Explain for every plan or package that meets the selection criteria (if you entered selection criteria in Plan/Collid or DBRM/Package).

Change Options

Indicate whether to change the Explain option.

Press Enter.

When you enter a question mark (?) in Location, DB2 SSID, or Target SSID, the DB2 SSID/Location Selection panel appears.

Note: For information about using this panel, see the General Facilities Reference Guide.

When you enter a question mark (?) in Profile, the Explain Profile Selection List panel appears. Complete the procedure described in Select an Explain Profile.

Chapter 5: Using Quick Explain and Explain Strategy Services 101

Page 102: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

When you enter selection criteria in Plan/Collid or DBRM/Package and enter Y in Selection List, the appropriate Catalog Data panel appears for the objects to include in the strategy. Complete the procedure described in Select Objects to Explain.

To change the Explain options, the Explain Strategy - Explain Options panel appears. Complete the procedure described in Specify Explain Options.

When the preceding conditions do not apply (or when you have completed the preceding conditions), Plan Analyzer processes the changes and continues to show the Explain Strategy - Regular Mode panel. Perform one of the following:

■ To save the strategy for further updates or processing, press PF3 (End).

■ The Explain Strategy Services panel appears.

■ To switch to Expert mode, enter EXPERT on the command line and press Enter.

The Explain Services Data Editor panel appears with any specified strategy information. For more information, see Procedures for Explain Strategy Services in Expert Mode.

■ To perform an Explain, complete the procedure described in Execute an Explain.

Deleting Strategies

Use the D line command to delete an existing strategy.

To delete strategies, enter D in the line command fields of the Explain Strategy Services panel next to the strategies to be deleted, and press Enter.

CA Plan Analyzer deletes the selected strategies, refreshes the list of strategies and versions, and a message appears indicating that the strategies have been deleted.

102 User Guide

Page 103: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Browse a Strategy

After saving a strategy, use the B line command to browse for information about the SQL sources for the strategy.

To browse a strategy

1. Enter B in the line command field of the Explain Strategy Services panel next to the strategy to browse.

Press Enter.

The Browse Explain Strategy panel appears.

2. Enter U in the OP field for the source to view the options used for the SQL source.

Press Enter.

Depending on the values entered, one of the following occurs:

■ If you entered U in the OP field, the Explain Strategy - Source Options panel appears. Continue with step 3.

■ If you did not enter U in the OP but you selected more than one strategy on the Explain Strategy Services panel, Plan Analyzer continues to show the Browse Explain Strategy panel. Continue with step 5.

3. Enter U in the fields for the options to browse on the Explain Strategy - Source Options panel.

Press Enter.

The browse panels appear in the following order:

a. Browse Historical Database Options

b. Browse Explain Strategy Reports

c. Browse Explain Strategy Catalog Statistics

d. Browse Explain Strategy Search Cond.

e. Browse Explain Strategy Access Filter

f. Browse Explain Strategy Filters

g. Browse Explain Strategy Parallelism Degree

4. Press PF3 (End) to exit the current browse panel and show the next one.

After showing the final selected browse panel, the Explain Strategy - Source Options panel appears.

Chapter 5: Using Quick Explain and Explain Strategy Services 103

Page 104: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

5. Press PF3 (End).

■ If you selected only one strategy to browse or you selected more than one strategy and are browsing the last strategy, the Browse Explain Strategy panel appears. Continue with step 6.

■ If you selected more than one strategy and have not yet browsed the last strategy, the Browse Explain Strategy panel appears for the next selected strategy. Continue with step 2.

6. Press PF3 (End).

The Explain Strategy Services panel appears.

Control the Appearance of Versions

You can use the following procedures to control the appearance of all versions for selected strategies or globally (for all strategies).

To control the appearance of versions for selected strategies, enter L in the line command fields next to the strategies that have versions to control and press Enter. If the versions have been shown previously, the list of the selected strategies collapses to show only the strategy name. If the versions have not been shown previously, the list of the selected strategies expands to show the strategy names and their corresponding versions.

To control the appearance of versions globally, enter L on the command line of the Explain Strategy Services panel and press Enter. If the previous list showed versions for all strategies, the list collapses to show only the strategies. If the previous list did not show versions for all strategies, the list expands to show all strategy names and their corresponding versions.

Deleting Versions

To delete a strategy version, enter D in the line command field of the Explain Strategy Services panel next to the strategy version to be deleted and press Enter. Plan Analyzer deletes the version, updates the selection list, and a message appears indicating that the version has been deleted.

104 User Guide

Page 105: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Browsing Version Input Statements

Use the I line command to view the Explain input statements of any strategy version.

To browse version input statements

1. Enter I in the line command field of the Explain Strategy Services panel next to the version that has the input statements to view.

Press Enter.

The input statements appear on the Display Version Output panel.

2. Press PF3 (End) when you have finished browsing the input statements.

The Explain Strategy Services panel appears.

Browse Reports

To save reports during Explain processing, use Plan Analyzer to browse all or only selected reports.

■ The O line command lists the results of all enhanced Explain reports that were generated for the Explain of a strategy version.

■ The R line command browses a specific enhanced Explain report for a strategy version.

Note: For more information, see the CA Plan Analyzer Reference Guide.

To browse all enhanced Explain reports

1. Enter O on the Explain Strategy Services panel next to the strategy version that have enhanced Explain reports to view.

Press Enter.

The reports appear on the Display Version Output panel.

2. Press PF3 (End) when you have finished browsing the reports.

The Explain Strategy Services panel appears.

Chapter 5: Using Quick Explain and Explain Strategy Services 105

Page 106: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

To browse only selected enhanced Explain reports

1. Enter R on the Explain Strategy Services panel next to the strategy version that has the reports to view.

Press Enter.

The Output Selection panel appears.

2. Enter S in the line command fields next to the available reports that to view.

Press Enter.

The selected reports appear on the Display Version Output panel.

3. Press PF3 (End) when you have finished browsing the reports.

The Explain Strategy Services panel appears.

Procedures for Explain Strategy Services in Expert Mode

To use the Explain Strategy Services facility in expert mode, you must set your CA Plan Analyzer profile to use expert mode and select the Explain Strategy Services menu option.

Note: Before using Explain Strategy Services, be sure to understand the differences among strategies, strategy versions, and historical versions. For more information, see Explaining SQL.

To select expert mode and access Explain Strategy Services

1. Access the Profile Variables screen.

For details, see About Explain Modes.

2. In Expert Mode default, enter Y.

3. Press Enter.

CA Plan Analyzer saves the change.

4. Press PF3 (End) twice.

The Main Menu appears.

5. On the Main Menu, enter 2 on the command line and press Enter.

The Explain Strategy Services screen appears.

106 User Guide

Page 107: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Creating a Strategy

Explain Strategy Services uses strategies to maintain information about Explain processing for selected SQL sources. Before performing any Explain processing, you need to create a strategy.

To create a strategy

1. Access Explain Strategy Services in Expert mode.

For more information, see Designate an Explain Processing Mode.

2. Enter information in the fields of the Create line on the Explain Strategy Services panel.

For fields that have defined lists of valid values, see the online help.

Line Command field

Enter C.

STRATEGY/VERSION

Enter a name for the strategy.

DESCRIPTION

(Optional) Enter a description for the strategy.

SO

Indicate the share option for the strategy.

Press Enter.

The Explain Strategy Data Editor panel appears.

3. Enter values in the indicated header fields.

For fields with defined lists of valid values, see the online help.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the Plan Analyzer parmlib. To display a selection list, enter a question mark (?). For more information about Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

Chapter 5: Using Quick Explain and Explain Strategy Services 107

Page 108: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Share Option

(Optional) Change the share option of the strategy by clearing the value that appears and entering a new value.

Description

(Optional) Change the description of the strategy by clearing the value that appears and entering a new value.

4. Enter values in the indicated fields of the Create line.

For fields with defined lists of valid values, see the online help.

Line Command field

Enter C.

TY

Indicate the type of SQL source for which you are creating an entry.

TARGET SSID

Specify the ID of the DB2 subsystem where the Explain will occur.

TARGET RULE SET

Specify the rule set to use for rules analysis. For a selection list, enter a question mark (?).

OP

Indicate whether to specify source options. (Source options override Explain options.)

LOCATION

Specify the location of the SQL source. The default is LOCAL. For a selection list, enter a question mark (?).

SSID

Specify the ID of the DB2 subsystem for the SQL source. For a selection list, enter a question mark (?).

PLAN/COLLID

Indicate the name of the object for which you are creating an SQL source entry. Selection criteria are accepted.

DBRM/PKG

Indicate the name of the DBRM or package for which you are creating an SQL source entry. Selection criteria are accepted.

STMT

(Optional) Indicate the number of the specific SQL statement for which you are creating an SQL source entry. This field is only valid for plan and package source types.

108 User Guide

Page 109: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Press Enter.

If you use selection criteria for the previous options, various panels appear. See the following sections to complete these panels:

■ Select an Explain Profile

■ Select a Rule Set

■ Specify Source Options

■ Specify Locations

■ Select Objects to Explain

When you do not choose selection criteria or when you complete the appropriate panels, CA Plan Analyzer processes your changes and continues to show the Explain Strategy Data Editor panel.

5. Perform one of the following:

■ To save the strategy for further updates or processing, press PF3 (End). The Explain Strategy Services panel appears.

■ To perform an Explain, complete the procedure described in Execute an Explain.

Selecting an Explain Profile

When you enter a question mark (?) for Profile, the Explain Profile Selection List panel appears. On this panel, select an Explain profile to use. For more information about Explain profiles, see the chapter “Maintaining the Plan Table.”

To select an Explain profile, enter S in the line command field of the Explain Profile Selection List panel next to the Explain profile to use and press Enter. The selected Explain profile name is inserted into the Profile field.

Selecting a Rule Set

When you enter a question mark (?) for TARGET RULE SET, the Rule Set Selection List panel appears. On this panel, select a rule set to use. For more information about rule sets, see the chapter “Updating Expert System Rules.”

To select a rule set, enter S in the line command field of the Rule Set Selection List panel next to the rule set to use and press Enter. The selected rule set is inserted into the Explain Options Target Rule Set field and processing checks the next field in the Explain Options panel. If the rest of the Explain Options fields are valid, the user can directly enter into the Batch Processor Explain card display after pressing Enter for target rule set selection.

Chapter 5: Using Quick Explain and Explain Strategy Services 109

Page 110: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Specifying Source Options

On the Explain Strategy - Source Options panel, select the options to specify for the current SQL source.

To specify source options

1. Enter values in the indicated fields of the Explain Strategy - Source Options panel. For fields that have a defined list of valid values, see the online help.

Database Options

Indicate whether to change the historical database options.

Reports

Indicate whether to view, change, or ignore report options.

Catalog Statistics

Indicate whether to view, change, or ignore catalog statistics for the Explain.

Search Conditions

Indicate whether to view, change, or ignore search condition options.

Access Path Filters

Indicate whether to view, change, or ignore access path filters.

Search Filters

Indicate whether to view, change, or ignore search filter options.

Parallelism Degree

Indicate the degree of parallelism to use during Explain processing.

Press Enter.

To change the historical database options, the Historical Database Options panel appears. Complete the steps in Specify Historical Database Options.

To change report options, the Explain Strategy Reports panel appears. Complete the steps in Specify Report Options.

To change catalog statistics for the Explain, complete the steps in Changing Catalog Statistics.

To change search condition options, the Explain Strategy Search Conditions panel appears. Complete the steps in Specify Search Conditions.

110 User Guide

Page 111: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

To change access path filters, the Explain Strategy Access Path Filter panel appears. Complete the steps in Specify Access Path Filters.

To change search filter options, the Explain Strategy Filters panel appears. Complete the steps in Specify Search Filter Options.

If the preceding conditions do not apply (or if you have completed the preceding conditions), CA Plan Analyzer continues to show the Explain Strategy - Source Options panel.

2. Press PF3 (End).

CA Plan Analyzer saves the source option settings and continues to the appropriate panel. The user may be returned to different locations depending on where the source options panel was entered from.

Specifying Locations

When you enter a question mark (?) for LOCATION or SSID, the DB2 SSID/Location Selection panel appears.

Note: For more information, see the General Facilities Reference Guide.

Selecting Objects to Explain

When you specify a catalog enter TY and enter selection criteria in PLAN/COLLID or DBRM/PKG, a Catalog Data panel appears. On the Catalog Data panel, you must select one or more objects to include in the explain.

To select sources from a catalog list

1. On the Catalog Data panel, enter S in the line command fields next to the names of the objects you want to explain.

2. Press Enter.

A message displays indicating that the selected objects have been queued.

3. (Optional) Repeat steps 1 and 2 to select additional objects.

4. (Optional) Enter S on the command line and press Enter.

The Data Queue panel appears with a list of all the objects you selected. For more information, see Managing Selection Lists.

5. Press PF3 (End).

Chapter 5: Using Quick Explain and Explain Strategy Services 111

Page 112: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Executing an Explain

Explain Strategy Services lets you execute an Explain during strategy creation and after saving a strategy. Use the EXPLAIN primary command to execute an Explain without saving the output. Use the E line command to execute an Explain and save the output.

To execute an Explain during strategy creation

1. Enter EXPLAIN on the command line of the Explain Services Data Editor panel.

Press Enter.

The Explain Strategy - Explain Options panel appears.

2. Update the values on this panel as necessary.

Press Enter.

For more information, see Specify Explain Options.

The Batch Processor Card Display panel appears.

Continue with one of the procedures described in How to Perform a Quick Explain in Regular Mode.

To explain a saved strategy

1. Enter E in the line command fields of the Explain Strategy Services panel next to the strategies to explain.

Press Enter.

The Version Info panel appears.

2. Enter values in the indicated fields.

For fields that have defined lists of valid values, see the online help.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the CA Plan Analyzer parmlib. To display a selection list, enter a question mark (?). For more information about Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

Identifier

Enter a name for the new strategy version, or to use a system-generated identifier, leave the Identifier field blank.

112 User Guide

Page 113: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Description

Enter a description of the new strategy version.

Replace Existing Version

Indicate whether to replace an existing version that has the same name that you specified in the Identifier field.

Update Explain Options

Indicate whether to update Explain options.

Press Enter.

One of the following occurs:

■ If you enter a question mark (?) for Profile, the Explain Profile Selection List panel appears. Continue with step 3.

■ If you are updating Explain options, the Explain Strategy - Explain Options panel appears. Continue with step 4.

■ If neither of these conditions apply, the Batch Processor Card Display panel appears. Continue with step 5.

3. Enter S in the line command field of the Explain Profile Selection List panel next to the Explain profile to use.

Press Enter.

The Version Info panel appears with a message indicating that Explain profile options will be used during Explain processing.

■ To override options from the Explain profile, continue with step 4.

■ To use the Explain profile without overrides, skip to step 5.

4. Update the values as necessary on the Explain Strategy - Explain Options panel.

Press Enter.

The Batch Processor Card Display panel appears.

For more information, see the Specifying Explain Options section.

Continue with one of the procedures described in How to Perform a Quick Explain in Regular Mode.

Chapter 5: Using Quick Explain and Explain Strategy Services 113

Page 114: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Updating a Strategy

Use the U line command to update a saved strategy.

To update a strategy

1. Enter U at the line command of the Explain Strategy Services panel next to the strategy to update.

Press Enter.

The Explain Strategy Data Editor panel appears with the existing data for the strategy.

2. Enter values in the indicated header fields. For fields with defined lists of valid values, see the online help.

Profile

(Optional) After you have created an Explain profile, specify the name in the Profile field. When entering the panel, if the Profile field is empty, then by default this field will be automatically filled with the PROF_NAME value from the CA Plan Analyzer parmlib. To display a selection list, enter a question mark (?). For more information about Explain Profiles, see Select an Explain Profile.

Note: The Profile name is now automatically saved whenever the user exits from the Editor (with no errors and without entering CANCEL).

Share Option

(Optional) To change the share option of the strategy, clear the value that appears and enter a new value.

Description

(Optional) To change the description of the strategy, clear the value that appears and enter a new value.

Press Enter.

If you enter a question mark (?) in Profile, the Explain Profile Selection List panel appears. Complete the procedure described in Select an Explain Profile.

If you enter a question mark (?) in TARGET RULE SET, the Rule Set Selection List panel appears. Complete the procedure described in Select a Rule Set.

To change the source options, the Explain Strategy - Source Options panel appears. Complete the procedure described in Specify Source Options.

114 User Guide

Page 115: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

When you enter a question mark (?) in LOCATION or SSID, the DB2 SSID/Location Selection panel appears. On this panel, select an location to use and press Enter. The selected location is inserted into the appropriate field.

Note: For information about using this panel, see the General Facilities Reference Guide.

If you select a catalog enter TY and enter selection criteria in PLAN/COLLID or DBRM/PKG, the appropriate Catalog Data panel appears. Complete the procedure described in Select Objects to Explain.

If none of these conditions apply, CA Plan Analyzer processes the changes and continues to show the Explain Strategy Data Editor panel. Perform one of the following:

■ To save the strategy for further updates or processing, press PF3 (End).

The Explain Strategy Services panel appears.

■ To perform an Explain, complete the procedure described in Execute an Explain.

Deleting Strategies

Use the D line command to delete an existing strategy.

To delete strategies, enter D in the line command fields of the Explain Strategy Services panel next to the strategies to be deleted, and press Enter.

CA Plan Analyzer deletes the selected strategies, refreshes the list of strategies and versions, and a message appears indicating that the strategies have been deleted.

Browsing Strategies

After saving a strategy, use the B line command to view information about the SQL sources for the strategy.

Controlling the Display of Versions

You can toggle the display of all versions for selected strategies, or globally for all strategies. For more information, see Controlling the Appearance of Versions.

Deleting Versions

To delete a strategy version, enter D in the line command field of the Explain Strategy Services panel next to the strategy version to be deleted and press Enter. Plan Analyzer deletes the version, updates the selection list, and a message appears indicating that the version has been deleted.

Chapter 5: Using Quick Explain and Explain Strategy Services 115

Page 116: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Browsing Version Input Statements

Use the I line command to view the Explain input statements of any strategy version.

To browse version input statements

1. Enter I in the line command field of the Explain Strategy Services panel next to the version that has the input statements to view.

Press Enter.

The input statements appear on the Display Version Output panel.

2. Press PF3 (End) when you have finished browsing the input statements.

The Explain Strategy Services panel appears.

Procedures for Quick Explain and Explain Strategy Services

In Expert mode, you can queue multiple catalog source entries for a single explain. The selections you make on Catalog Data and Source panel types are stored in queues. Using line and primary commands, these panel types let you manage the selections you have made.

Managing Selection Lists

To switch from the Catalog Data panel to the selection queue, enter S or SHRINK on the command line and press Enter. The selected objects appear on the corresponding Data Queue panel.

To remove objects from the selection queue

1. Access the Data Queue panel.

2. Remove the S entry in the line command field next to the SQL source to remove from the queue.

Press Enter.

The SQL source is removed from the queue.

Note: To switch from the selection queue to the Catalog Data panel enter S or SHRINK on the command line and press Enter. The selected objects appear on the corresponding Catalog Data panel.

Specifying Historical Database Options

Use the Historical Database Options panel to specify how you want Plan Analyzer to handle any existing versions of the Explain you are working with and what to name the new version.

116 User Guide

Page 117: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

You can only choose one method to manage historic versions, depending on the mode in which you are using Quick Explain or Explain Strategy Services. The following table indicates when the hversion management methods are available:

Hversion Management Method

Quick Explain Expert Mode

Quick Explain Regular Mode

Explain Strategy Services Expert Mode

Explain Strategy Services Regular Mode

Save data as a strategy X X

Automatic hversioning X X X

Manual hversioning X X X X

To specify historical database options for saving historic data as a strategy, enter values in the indicated fields of the Historical Database Options panel.

Save Historic Data as a Strategy

Enter Y.

Automatic Historic Versioning

Leave blank.

Update CURRENT HVersion

Enter N.

Create New HVersion

Enter N.

Press PF3 (End).

Plan Analyzer saves your selections and continues to the appropriate panel.

To specify historical database options for automatic hversioning, enter values in the indicated fields of the Historical Database Options panel.

Save Historic Data as a Strategy

If this field appears, enter N.

Update CURRENT HVersion

Enter N.

Chapter 5: Using Quick Explain and Explain Strategy Services 117

Page 118: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Create New HVersion

Enter N.

Automatic Historic Versioning

Do one of the following:

■ Enter a question mark (?). and press Enter.

■ The Auto HVersion Selection List panel appears. Enter S next to the auto hversion profile to use.

■ Enter the name of the auto hversion profile to use.

Press PF3 (End).

Plan Analyzer saves your selection and continues to the appropriate panel.

To specify historical database options

1. Enter values in the indicated fields of the Historical Database Options panel.

Save Historic Data as a Strategy

If this field appears, enter N.

Automatic Historic Versioning

If this field appears, leave it blank.

2. Enter Y in the Update CURRENT HVersion or Create New HVersion fields.

If you entered Y for Update CURRENT HVersion, Plan Analyzer updates the hversion named CURRENT.

Enter values in the indicated fields. For fields that have a defined list of valid values, see the online help.

New HVersion Name

Specify a name for the new hversion. The name can be from one to eight characters in length.

Create New HVersion Before or After Explain

Indicate whether to create the new hversion before or after processing the Explain.

Replace New HVersion If Exists

Indicate whether to replace an existing hversion that has the same name as specified in New HVersion Name.

118 User Guide

Page 119: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

If you enter Y for Create New HVersion, CA Plan Analyzer creates a new hversion using the name you specify.

Press PF3 (End).

Plan Analyzer saves the information you entered and continues to the appropriate panel.

Specifying SQL Qualifiers

Use the SQL Qualifiers panel to indicate preferences for qualifying unqualified tables and views.

To specify SQL qualifiers

1. On the SQL Qualifiers panel, enter values in the indicated fields.

For fields that have a defined list of valid values, see the online help.

SQL Qualifier ID

Enter the user ID that CA Plan Analyzer should use to qualify any unqualified table name references.

SQL Qualifier Override

Indicate whether to override the SQL qualifier for unqualified, catalogued SQL.

View Qualifier ID

Enter the user ID that CA Plan Analyzer should use to qualify any unqualified view references.

Use View Creator

Indicate whether unqualified views should be qualified by the CREATOR field from SYSIBM.SYSTABLES.

Path Schema

Indicate whether to update path schemas. Entering U or Y displays the Edit Path Schemas Facility panel.

Enter path schema information as desired, then press PF3 (End) to return to the Explain Strategy - SQL Qualifiers panel.

2. Press PF3 (End).

CA Plan Analyzer saves the information you entered and continues to the appropriate panel.

Chapter 5: Using Quick Explain and Explain Strategy Services 119

Page 120: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

Changing Catalog Statistics

On the Explain Options panel, indicate whether to change or ignore catalog statistics for the Explain. To change the catalog statistics, access the Statistics Manager Services panel. For more information, see the chapter “Using Statistics Manager.”

Specifying Search Conditions

When you do not select any syntax elements, CA Plan Analyzer explains all statements that contain the selected statement type. For example, if you select the statement, enter INSERT, and do not select any syntax elements, CA Plan Analyzer explains all INSERT statements for the specified plan and DBRM.

When you select two or more syntax elements, CA Plan Analyzer searches for the selected elements according to the value entered as the element conjunction.

AND

For example, if you selected the syntax elements UNIONs and ORDER BY clause with the conjunction AND, CA Plan Analyzer will search for the SQL statements that contain both UNIONs and ORDER BY clauses.

OR

For example, if you selected the same syntax elements, but this time you use the OR conjunction, CA Plan Analyzer will search for the SQL statements that contain UNIONs or ORDER BY clauses.

Several syntax elements can be grouped under one element heading. You can select the element heading to search for all the items included under it. The following example demonstrates this point:

____ Subqueries

____ Noncorrelated subqueries

____ Correlated subqueries

____ Subqueries of 1_ through 99 levels

120 User Guide

Page 121: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

The indented items are grouped under the element heading, Subqueries. When you enter S in the line next to Subqueries, CA Plan Analyzer explains the SQL statements that have noncorrelated subqueries, correlated subqueries, and subqueries with a maximum of 99 nestings. When you enter S in the line next to Correlated subqueries, CA Plan Analyzer explains only those statements that have correlated subqueries.

To specify search conditions

1. Enter S next to one or more statement types to search in the Choose Statement Types on the Search Conditions panel.

The Search Condition facility determines what statements are ultimately explained based on the criteria selected by the user. These search conditions are saved and later used at Explain time.

2. Indicate the element conjunction to use in the Joining Multiples field.

The element conjunction determines whether the search condition elements selected by the user will be AND or OR together.

3. Enter S in the line command fields next to the syntax elements to select and press PF3 (End).

Note: Use PF7 (Up) and PF8 (Down) to scroll through the syntax element section.

CA Plan Analyzer saves the changes and continues to the appropriate panel.

Press PF3 (End).

CA Plan Analyzer saves the search condition settings and returns to the Explain Options panel.

Specifying Access Path Filters

The CA Plan Analyzer Access Path Filters panel lets you choose to explain only SQL statements that match certain access methods. For example, you can choose to explain only those statements that contain LOCKS, tablespace scans, or non-matching index scans.

Chapter 5: Using Quick Explain and Explain Strategy Services 121

Page 122: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

The Access Path Filters panel lets you to customize a query configuration through the use of element conjunctions and search elements. After you define a query configuration, CA Plan Analyzer explains and reports on only those statements that match your specifications.

To specify access path filters

1. Indicate the element conjunction to use in the Joining Multiples field.

2. Enter S in the line command fields next to the selected access method criteria and press PF3 (End).

Note: Use PF7 (Up) and PF8 (Down) to scroll through the access method criteria section.

Press PF3 (End)

CA Plan Analyzer saves the access path filter settings and returns to the Explain Options panel.

Specifying Search Filter Options

DB2 does not offer column reference, so you cannot specify a character string that must be contained within the SQL statement to be explained. The CA Plan Analyzer Search Filters option lets you enter character strings that must be contained within the SQL statement before the statement can be selected for Explain processing. This lets you reference column or table names.

The search filters let you specify character strings by separating the strings with commas. For example, if you enter SALARY, PAYROLL, CA Plan Analyzer searches for all character strings that contain the word SALARY or PAYROLL. CA Plan Analyzer also lets you find objects or lists.

To specify search filter options, enter the required character strings for the SQL statements to explain in the entry fields on the Filters panel and press PF3 (End). CA Plan Analyzer saves your changes and continues to the appropriate panel.

About Embedded Spaces

Qualified objects, such as CREATOR.TABLE, are stored with blanks surrounding the period. CA Plan Analyzer recognizes all spaces and lets you use spaces for search criteria.

Filters ===> xxxxxx . MYTABLE . MYCOL1

===>

In this example, xxxxxx . MYTABLE . MYCOL1 is used to request a string search on all columns named MYCOL1 within table MYTABLE created by xxxxxx. Notice that a single space is entered on either side of the period ( . ).

122 User Guide

Page 123: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

About Embedded Commas

Sometimes you might want to search for strings that normally contain commas within them. For example, if you wanted to search for an ORDER BY clause that references numerous columns, you would use commas to separate the column names. The separated column names are treated as one string. This is possible through the use of double quotation marks around the characters that you want recognized as one string.

Filters ===> "ORDER BY COL1 , COL2 , COL3",xxxxxx

===>

In this example, ORDER BY COL1 , COL2 , COL3 is recognized as one string and xxxxxx is recognized as another string. The double quotation marks (“) around the ORDER BY clause indicates to recognize the clause as one string. Without the double quotation marks, CA Plan Analyzer would search for four strings: ORDER BY COL1 as one string, COL2 as another string, COL3 as the third string, and xxxxxx as the fourth string.

Notice that there is a space after COL1 and after its comma. Then, there’s a space after COL2 and after its comma. Because CA Plan Analyzer stores SQL text in a format that could be different from the original SQL text that was entered, you must include blanks around the commas to match the CA Plan Analyzer internal format.

Do not include a space before the first double quotation mark when you want the items to be searched as one string. For example, if you entered,

FILTERS ===> xxxxxx, "ORDER BY COL1 , COL2 , COL3"

===>

where there was a space between the comma and the first double quotation mark, CA Plan Analyzer would recognize the ORDER BY string as including the quotation marks within the search. For more information, see About Embedded Quotation Marks.

Chapter 5: Using Quick Explain and Explain Strategy Services 123

Page 124: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

About Embedded Quotation Marks

When you want to include strings that must contain double quotation marks, you must include a non-quote, such as a space, before the first double quotation mark. For example, if you created a table named PLAN, PLAN is a reserved word DB2 uses and it would not let you create that table unless double quotation marks were used. Therefore, when you wanted to request a search for “PLAN” where the double quotation marks were a part of the table name, you would have to leave a space before the first double quotation mark.

Filters ===> xxxxxx, "PLAN"

===>

In this example, the space (non-quote) before the double quotation mark belonging to PLAN indicates to CA Plan Analyzer to use the double quotation marks with the search so that “PLAN” is the complete string.

About Authorization IDs

The following list describes the authorization IDs CA Plan Analyzer uses for explain processing. These IDs can all be specified on the Explain Options panel.

Primary AUTHID

This is the authorization ID that is used to establish the connection to DB2. When this field is left blank, the primary authorization ID is your logon ID.

Secondary AUTHID

This ID is used as the creator ID of the PLAN_TABLE to which DB2 will insert the results of your explain. When you leave this field blank, CA Plan Analyzer uses your primary authorization ID.

When you specify a secondary ID, CA Plan Analyzer uses the primary ID to connect to DB2, then issues a SET CURRENT SQLID command to change the current SQLID to the specified secondary ID. This ID must be one of your secondary IDs, or you must be a SYSADM.

Note: This ID does not qualify unqualified tables. CA Plan Analyzer qualifies unqualified table references before the dynamic explain occurs. For more information, see Resolving Unqualified Object Names.

For Future type explains only, the secondary AUTHID is the creator of the PLAN_TABLE.

Note: for more information, see the CA Plan Analyzer Reference Guide.

124 User Guide

Page 125: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

SQL Qualifier ID

When the SQL to be explained is not retrieved from the catalog (free-form SQL, file, PRF, QMF, and DBRM library input), the SQL Qualifier ID is used as the implicit qualifier. When you leave this field blank, CA Plan Analyzer uses the ID specified for the secondary AUTHID.

SQL Qualifier Override

Use the SQL Qualifier Override feature to have the SQL Qualifier ID override any other qualifier that would have applied when the SQL is retrieved from a plan or a package.

Resolving Unqualified Object Names

Before an SQL statement is explained, CA Plan Analyzer qualifies any unqualified tables, views, or aliases and replaces synonyms with the fully qualified name of the table or view on which the synonym is defined. Because of this explicit qualification of unqualified references, you can direct the Explain output to any PLAN_TABLE by specifying the secondary AUTHID.

The following table outlines the logic Plan Analyzer uses to resolve unqualified object names for plans and packages.

Conditions Qualifier Used

Explained statements are from a plan or a package.

SQL Qualifier Override on the SQL Qualifiers panel is marked Y (Yes).

SQL Qualifier ID

Explained statements are from a plan.

Source and target DB2 SSID are the same.

SQL Qualifier Override on the SQL Qualifiers panel is marked N (No).

The QUALIFIER or OWNER column of the plan's SYSPLAN entry

Explained statements are from a plan.

Source and target DB2 SSIDs are different.

Same-named plan is bound on the target DB2 SSID.

SQL Qualifier Override on the SQL Qualifiers panel is marked N (No).

The QUALIFIER or OWNER column of the plans bound on the target DB2 subsystem

Explained statements are from a package.

Source and target DB2 SSIDs are the same.

SQL Qualifier Override on the SQL Qualifiers panel is marked N (No).

The QUALIFIER column of the package's SYSPACKAGE entry

Chapter 5: Using Quick Explain and Explain Strategy Services 125

Page 126: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Choosing Explain Facilities

126 User Guide

Conditions Qualifier Used

Explained statements are from a package.

Source and target DB2 SSIDs are different.

A package with the same collection ID and package ID is bound on the target DB2 subsystems.

SQL Qualifier Override on the SQL Qualifiers panel is marked N (No).

The QUALIFIER column of the package bound on the target DB2 subsystem

The following table outlines the logic CA Plan Analyzer uses to resolve unqualified object names for all other SQL sources:

Conditions Qualifier Used

All other cases (qualifier undetermined).

Free-form SQL, File, PRF, QMF, and DBRM Library Input.

SQL Qualifier ID

Page 127: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 6: Querying the Explain Database

This section contains the following topics:

Accessing the Query Explain Database Feature (see page 127) Generating Reports (see page 128) Controlling Report Hierarchy Display (see page 129)

Accessing the Query Explain Database Feature This section explains the routines available for querying the historical source database.

CA Plan Analyzer can write information to the historic database each time explain processing is executed against an SQL source. A historical version includes enhanced explain reports (when applicable), input statements, and statistics about the explain. The historical version output is stored in the CA Plan Analyzer historical database.

You can query the historical database with the Query Explain Database facility to retrieve information about an SQL source that has been explained. For example, you can determine the access methods your SQL uses most frequently, the most costly SQL statements, the statement types used frequently, and the objects referenced.

The Query Database facility offers five reports. Each report focuses on a different aspect of your explain.

Explain Summary

Displays the access methods used and helps you determine what other factors affect performance.

Cost Summary

Analyzes the relative, average, and maximum costs incurred when you execute the SQL.

Statement Type Summary

Summarizes the number of SELECT, UPDATE, INSERT, DELETE, and MERGE statements that the SQL uses.

Chapter 6: Querying the Explain Database 127

Page 128: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Reports

Object Summary

Identifies the number of tables and indexes that an SQL statement references.

Information Summary

Summarizes object information.

Note: You can use the Batch Reporting facility to generate any of these summary reports in batch mode. For more information, see the CA Plan Analyzer Reference Guide.

Additionally, you can generate two detailed informational panels:

Database INFO Display

Provides detailed object and statement information.

Performance Database Display

Provides detailed information about an object's performance data.

Note: For more information about the panels, fields, and reports discussed in this chapter, see the CA Plan Analyzer Reference Guide.

You can access the Query Explain Database feature from the Main Menu. Enter 3 on the command line and press Enter. The Query Explain Database Menu appears.

Generating Reports Use the header fields of the Query Explain Database Menu to specify the SQL sources to analyze and the type of report to view. When completing the header fields, keep these guidelines in mind:

■ You can limit the SQL source lists to the following:

– Plans, DBRMs, collection IDs, and packages

– Other explained SQL sources, such as exported PRF or QMF queries

Note: You cannot mix these source types in a single SQL source list.

■ When you specify a statement number in STMTNO, a fully exploded hierarchical view displays. To view the statement text, enter X in the line command field next to the statement number and press Enter.

■ To switch from one report to another for the same set of SQL sources, you do not have to return to the Query Explain Database menu. Instead, change the report type specified in Report and press Enter.

128 User Guide

Page 129: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

To generate an Explain, Cost, Statement Type, Object, or Information Summary report

1. Access the Query Explain Database Menu.

For more information, see Accessing the Query Explain Database Feature.

2. In Report, indicate the report type.

Valid values are:

ES

Explain Summary

CS

Cost Summary

SS

Statement Summary

OS

Object Summary

IS

Information Summary

3. Complete the appropriate header fields to indicate the SQL sources you want.

Press Enter.

CA Plan Analyzer generates and and shows the report.

Controlling Report Hierarchy Display The techniques described in this section also apply to the Identify Problem SQL and Source Database Maintenance facilities.

Determining the Initial Hierarchical Level

Use the Query Explain Database header fields to control the initial hierarchical level at which reports display. When you only enter information in higher-level fields, for example, your report shows only those higher levels. You can change the header fields as needed to view different levels of the report.

Chapter 6: Querying the Explain Database 129

Page 130: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The following table describes the reporting hierarchy:

To initially display SQL information at the...

Enter criteria in the following fields...

Group level (highest level) Plan or Collid

Object level Plan and DBRM or Collid and Package

Statement level (lowest level) Plan, DBRM, and STMTNO or Collid, Package, and STMTNO

Understanding the Hierarchical Display

The Query Explain Database facility shows the hierarchical relationship of hversions, groups, objects, and statements by the relative positions of the item names. The following example shows the PPA QED Explain Summary panel.

PPQDES -------- PPA QED Explain Summary -------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> * Cost ===> DBOPTS ===> ALL DBRANGE ===> 099 FILTER ===> N Plan ===> DBRM ===> STMTNO ===> Collid ===> * Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ xxxxxx xxxxxxx Stra ____ V00002 ____ PAAM021S_ANL (CO) 643 17 407 63 393 31 ____ PAA$ATHD (PK) 1 - - - 2 2 ____ 1,047 - - - - - 1 ____ 1,109 - - - - - 1 ____ 1,119 - - - - 1 - ____ 1,290 1 - - - 1 - ____ PAA$ATHM (PK) - - - - - 1 ____ 393 - - - - - 1

130 User Guide

Page 131: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The following list describes the hierarchical fields that appear on every Query Explain Database summary report. All fields are for display only.

HVERSION

For strategies, the creator and name of the strategy. For auto and manual hversions, the name of the hversion.

LEVEL

When valid, this field appears slightly indented and immediately following HVERSION.

■ For strategies, the version of the strategy.

■ For auto hversions, the level of the hversion. Level +0 contains the most recently generated data for the hversion.

■ For manual hversions, this field is not displayed.

GROUP

The name of the group. This field appears slightly indented and immediately following LEVEL.

OBJECT

The name of the object. This field appears slightly indented and immediately following GROUP.

STMT

The statement number. This field appears slightly indented and immediately following OBJECT.

Type

The item type.

For hversions, this field indicates how the hversion was generated.

Valid values are:

■ Stra: Strategy

■ Man: Manual hversion

■ Auto: Automatic hversion

At the group level, Valid values are:

■ (CO): Collection

■ (DB): DBRMLIB

■ (FI): File

■ (P): Exported PRF query

■ (PL): Plan

■ (PQ): PRF query

Chapter 6: Querying the Explain Database 131

Page 132: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

■ (Q): Exported QMF query

■ (QQ): QMF query

■ (SQ): SQL

At the object level, Valid values are:

■ (D): DBRM

■ (PK): Package. At the statement level, this field is blank.

Exploding the Report Display

You can explode report information globally or by selected report lines to show more detail.

When you explode a report globally, you expand the report display to include group, object, and statement information for all SQL sources that match the header criteria.

When you explode selected report lines, you expand the information about the lines you select to one more level of detail. When you explode a statement line, the statement text displays on the Explain Database SQL List panel. The following table summarizes the hierarchy display progression:

When you explode the... The resulting display is the...

Group level

Object level

Object level

Statement level

Statement level SQL statement text

To explode reports globally (after CA Plan Analyzer displays a report), enter EXPLODE in the command line and press Enter. The report redisplays showing group, object, and statement information for all SQL source that match the header criteria.

To explode selected report lines (after CA Plan Analyzer displays a report), enter X in the line command field next to the group, object, or statement for which you want more information. Press Enter. The report reappears showing additional detail information for the selected lines.

132 User Guide

Page 133: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

Resetting the Report Display

You can also collapse or reset, report displays globally or by selected report lines to show less detail.

When you reset a report globally, you collapse the report display to the highest level allowed by the selection criteria you entered in the header fields.

When you reset selected report lines, you collapse the information about the selected lines to one less level of detail.

To reset reports globally, enter RESET in the command line of a report and press Enter. The report display collapses to the highest level allowed by the selection criteria you entered in the header fields.

To reset selected report lines, enter RES in the line command field next to the group or object display to collapse. Press Enter. The report reappears showing less detail information for the lines you selected.

Examples

The following topics illustrate how to display all SQL sources of a specific type and how to explode a display from the group level to the statement level. In this example, a plan is the starting point, but you can use the same methodology to show subsequent levels of any SQL group.

Chapter 6: Querying the Explain Database 133

Page 134: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

Display All SQL Sources of a Specific Type

The following illustration shows a panel that can function as a selection list and can be generated for any of the SQL source types. To generate this panel, enter an asterisk (*) in Plan and press Enter to request all versions of all plans.

PPQDES -------- PPA QED Explain Summary -------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> Cost ===> DBOPTS ===> ALL DBRANGE ===> 099 FILTER ===> N Plan ===> * DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ PDUSERB USERTEST Stra ____ V00001 ____ PLANGEN1 (PL) - - - - - - ____ PDUSERB USERTEST Stra ____ VERS1 ____ PLANGEN1 (PL) R - - 2 - 2 3 ____ xxxxxx E2SAPLN Stra ____ V1 ____ M12LOCKS (PL) R - - - - 4 - ____ VERS NOT STRAT Stra

Explode a Group Level Displays

The following shows an SQL Group level display. To generate this display, enter a specific plan name in Plan and press Enter.

PPQDES -------- PPA QED Explain Summary -------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> Cost ===> DBOPTS ===> ALL DBRANGE ===> 099 FILTER ===> N Plan ===> PPAMP5CE DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ MARK0202 Man ____ PPAMP5CE (PL) 365 1 12 5 206 60 ____ PPAMP5CE (PL) 365 - 13 6 164 74 ******************************** BOTTOM OF DATA *******************************

134 User Guide

Page 135: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

To explode the plan level display, enter X in the line command field next to a plan version and press Enter. The following illustration shows the results.

PPQDES -------- PPA QED Explain Summary -------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> Cost ===> DBOPTS ===> ALL DBRANGE ===> 099 FILTER ===> N Plan ===> PPAMP5CE DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ MARK0202 Man ____ PPAMP5CE (PL) 365 1 12 5 206 60 ____ PAA#CCPY (D) - - - - - - ____ PAA#CDEL (D) - - - - - 3 ____ PAA#CINS (D) - - - - - - ____ PAA#DBRM (D) 4 - - - 4 - ____ PAA#PLDC (D) 1 - - - 3 - ____ PAA#PLDD (D) - - - - - - ____ PAA#PLDM (D) - - - - - 1 ____ PAA#PLDS (D) - - - - - -

To explode the object level display, enter X in the line command field next to a plan object and press Enter. The following panel shows the results.

PPQDES -------- PPA QED Explain Summary -------- COMMAND ===> SCROLL ===> PAGE Report ===> ES HVersion ===> Cost ===> DBOPTS ===> ALL DBRANGE ===> 099 FILTER ===> N Plan ===> PPAMP5CE DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> Creator ===> Type ===> ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ MARK0202 Man ____ PPAMP5CE (PL) 365 1 12 5 206 60 ____ PAA#CCPY (D) - - - - - - ____ 371 - - - - - - ____ 575 - - - - - - ____ 777 - - - - - - ____ 961 - - - - - - ____ 1,108 - - - - - - ____ 1,309 - - - - - - ____ 1,398 - - - - - -

Chapter 6: Querying the Explain Database 135

Page 136: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

To explode the statement level display, enter X in the line command field next to a statement and press Enter. The following illustration shows the Explain Database SQL List panel, which displays the text for the statement you chose to explode. Notice that the header fields are read-only and indicate the hversion, source type, group, object, and statement number for the SQL statement shown on this panel.

PPQEDC --------- PPA Explain Database SQL List -------- COMMAND ===> SCROLL ===> PAGE HVersion ===> USERxx02 Type ===> PLAN Group ===> PPAMP5CE Object ===> PAA#CCPY STMTNO ===> PLAN ----------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 ********************************* TOP OF DATA ********************************* SELECT STMT_HVERSION , STMT_SSID , STMT_PLAN , STMT_DBRM , STMT_LOCATION , STMT_SRC_TYPE , STMT_CONTOKEN INTO :H_ERR_STMT_HVERSION , :H_ERR_STMT_SSID , :H_ERR_STMT_PLAN , :H_ERR_STMT_DBRM , :H_ERR_STMT_LOCATION , :H_ERR_STMT_SRC_TYPE , :H_ERR_STMT_CONTOKEN FROM PTI.PTAN_STMT_0200 WHERE STMT_SRC_ID = :H_STMT_SRC_ID_NEW AND STMT_ID = 1 ******************************** BOTTOM OF DATA *******************************

To return to the previous level of the report, press PF3 (End).

Switching Among Reports

After you generate a Query Explain Database report, you can switch to another report for the same SQL sources without querying the database again.

To switch from one report to another using the same SQL sources

1. Generate a report.

For more information, see Generating Reports.

2. In Report, specify the report type to view next.

Press Enter.

The specified report appears.

136 User Guide

Page 137: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

To switch to a report using different SQL sources

1. Generate a report.

For more information, see Generating Reports.

2. In the header fields, specify different criteria for SQL sources and, optionally, a different report type.

Press Enter.

CA Plan Analyzer queries its database and the report appears.

Regenerating Reports from the Historical Database

You can regenerate Enhanced Explain reports from information contained in the CA Plan Analyzer historical database without exiting the Query Explain Database facility.

To regenerate a report

1. Generate a Query Explain Database report.

For more information, see the Generating Reports.

2. On the QED report panel, enter EXPLRPT at the prompt.

Press Enter.

3. The Historic Database Reporting panel appears.

A list appears showing each report available in Enhanced Explain.

Note: For more information, see the chapter “Using Quick Explain and Explain Strategy Services" and the CA Plan Analyzer Reference Guide.

4. Select the reports to generate, indicating long or short form where necessary.

Press Enter.

The Historic Database Reporting Options panel appears. These options are the same as those in Enhanced Explain.

5. Verify or update the fields as necessary.

Press Enter.

6. Run and review the reports.

7. When you have finished reviewing the Enhanced Explain reports, press PF3.

You are returned to the QED report panel.

Chapter 6: Querying the Explain Database 137

Page 138: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

About the Batch Job

Unlike in normal Enhanced Explain reports, the Batch Processor input generated by this feature for some reports uses SRCHDRS cards, which rely on a dynamic identification key. They are intended for immediate use-problems can arise if the job is held and the key becomes invalid.

To generate a scheduled batch report, specify a processing mode of Batch.

Filtering Reports

CA Plan Analyzer lets you filter the display of Query Explain Database report data according to chosen selection criteria. This is useful in troubleshooting or maintenance scenarios where reviewing lengthy reports is undesirable.

To filter report data

1. Specify a Y in the FILTER report header field to access the filter criteria panel.

2. Select filter criteria by entering Y or N at each prompt.

Note: Descriptive information is included on the panel.

3. Indicate whether to join the criteria with AND or OR.

Press Enter.

A report based on the selected filter criteria appears.

To deactivate report filters, specify an N in the report header field FILTER and press Enter to regenerate the report without using the specified filter criteria.

To update the filter criteria

1. Specify a U in the FILTER report header field to access the filter criteria panel.

2. Select filter criteria by entering Y or N at each prompt.

Note: Descriptive information is included on the panel.

3. Indicate whether to join the criteria with AND or OR.

Press Enter.

A report based on the selected filter criteria appears.

138 User Guide

Page 139: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

Viewing the Database Information Display

Using the INFO line command, you can view database information about objects and statements.

Note: For more information, see the CA Plan Analyzer Reference Guide.

To view a database information display

1. Generate a report.

For more information, see Generating Reports.

2. If the report does not already show the object or statement level, explode the hierarchical display.

For more information, see Exploding the Report Display.

3. In the line command field next to any object or statement shown on a Query Explain Database report, enter INFO.

Press Enter.

CA Plan Analyzer generates the database information display.

4. When you are done viewing the display, press PF3 (End).

You are returned to the previous report.

Viewing the Performance Database Display

Using the PERF line command, you can view performance data for packages, DBRMs, and SQL statements for which you have loaded performance data.

Note: You must load performance data from CA Detector into the CA Plan Analyzer database to view a meaningful performance database display. For more information, see the appendix “Using Performance Data.”

To indicate the availability of performance data, a P appears in the PD field of the reports.

Note: For more information, see the CA Plan Analyzer Reference Guide.

To view a performance database display

1. Generate a report.

For more information, see Generating Reports.

2. If the report does not already show packages, DBRMs, or SQL statements, explode the hierarchical display.

For more information, see Exploding the Report Display.

Chapter 6: Querying the Explain Database 139

Page 140: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

3. In the line command field next to any DBRM, package, or associated statement, enter PERF.

Press Enter.

CA Plan Analyzer generates the performance database display.

4. When you are done viewing the display, press PF3 (End).

You are returned to the previous report.

Using Line Commands

You can use line commands to invoke CA Plan Analyzer utilities, functions, or reports from any of the Query Explain Database reports. The line command you choose must be appropriate for the object to use it on.

List of Available Line Commands

The following list shows the line commands that are available from the Query Explain Database reports. To determine the commands valid for a particular line, see the online help. For more information, see the following section, Accessing Online Help.

A

Alias Dependency

ACC

Access Display

B

Bind

BO

Bind with Options

BR

Plan or Package Bind Parameters

C

Column Dependency

CEVN

Compare Explain Versions New

CEVO

Compare Explain Versions Old

140 User Guide

Page 141: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

D

Plan or Package Detail

DB

Database Dependency

DEP

Dependency Display

DI

Diagram Display

DP

Plan or Package Dependency

DR

DBRM Detail

DTR

Drop Trigger

E

Plan or Package Explain

EDIT

Edit

F

Free

I

Index Dependency

INFO

Database INFO Display

L

Plan or Package List

OBJ

Object Report

PERF

Performance Database Display

PI

Package or DBRM Plan Inclusion

Chapter 6: Querying the Explain Database 141

Page 142: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

142 User Guide

PP

Plan Packlist

PRED

Predicate Analysis

QE

Quick Explain

R

Rebind

RO

Rebind with Options

RR

Plan or Package Rebind Parameters

S

Synonym Dependency

ST

DBRM, Plan, or Package SQL Statement

STAT

Statistics Report Display

T

Table Dependency

TS

Tablespace Dependency

UA

Plan or Package User Authorization

V

View Dependency

X

Explode

Accessing Online Help

Enter a question mark (?) in the line command field and press Enter. An online help panel appears listing the available line commands.

Page 143: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 7: Comparing Explain Versions

This section contains the following topics:

What Is Compared (see page 143) Accessing the Compare Explain Versions Facility (see page 144) Comparing Versions of Existing Strategies (see page 144) Using Line Commands (see page 145) Accessing Online Help (see page 146)

What Is Compared The Compare Explain Versions feature lets you compare historical versions of a variety of SQL sources, including those within CA Plan Analyzer strategies. The SQL sources whose versions you can compare include:

■ Plan

■ Package

■ File

■ SQL contained in a CA Plan Analyzer strategy

■ DBRMLIB

■ Exported PRF query

■ Exported QMF query

■ PRF query

■ QMF query

■ SQL

Note: The SQL sources must have been explained before they can be compared.

CA Plan Analyzer begins the compare process by matching similar statements. These matched statements are referred to as paired statements. After the statements have been paired, the Compare Explain Versions report highlights access path changes and SQL cost changes with cost increase or decrease specified (using the short access path report), and the SQL text. This type of information can help you detect and analyze access path changes. The SQL cost comparison can quickly identify when a REBIND will cause performance degradation or improvement.

Chapter 7: Comparing Explain Versions 143

Page 144: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing the Compare Explain Versions Facility

A statement from one selected version that does not match a similar statement in the other version is an unpaired statement. CA Plan Analyzer cannot compare unpaired statements but can report on them. These unpaired statements can be caused by major changes to the SQL text or by adding or deleting statements. The Compare Explain Versions report can show these unpaired statements when you use reporting options.

CA Plan Analyzer provides many reporting options that let you choose the information you want displayed in the Compare Explain Versions report. You can also save the selected report options to your ISPF profile. These options are set up automatically the next time you use the Compare Explain Versions facility.

Note: For more information, see the CA Plan Analyzer Reference Guide.

Accessing the Compare Explain Versions Facility Access the Compare Explain Versions facility from the Main Menu by entering 4 in the command line and pressing Enter. The Compare Explain Versions panel appears.

The Compare Explain Versions display is very similar to the display of the Query Explain Database feature. For more information, see the chapter “Querying the Explain Database.“

Comparing Versions of Existing Strategies You can run Compare Explain Versions during explain processing by requesting the Compare Explain Versions report as one of your explain reports. You can also access Compare Explain Versions directly from the Main Menu to run a comparison of existing SQL sources.

To request a comparison during Explain strategy processing

1. Create an explain. See the “Using Quick Explain and Explain Strategy Services” chapter for more information.

2. When creating your explain, enter Y or U in the Reports field on the Explain Options panel. Press Enter. The Explain Strategy Reports panel appears.

3. Enter Y in the Compare field.

4. Press Enter. You are returned to the Explain Options panel.

5. Continue strategy processing as usual. CA Plan Analyzer generates the Compare Explain Versions report with the other reports you requested.

144 User Guide

Page 145: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

To compare versions of an existing strategy

1. Access the Compare Explain Versions panel. See the Accessing the Compare Explain Versions Facility section for more information.

2. In the header fields, specify criteria to identify the SQL source of the historical versions to compare. Selection criteria are accepted.

3. Press Enter. The Compare Explain Versions panel shows a list based on your selection criteria.

4. Select the two versions to compare. Enter CEVN in the line command field next to the first version and CEVO next to the second version.

5. Press Enter. The Compare Explain Versions Select panel appears.

6. Enter S next to the object to be compared and press Enter. The Compare Explain Versions Display panel appears.

Note: You can also generate the Compare Explain Versions report in batch. For more information, see the chapter “Using Batch Reporting.”

Using Line Commands You can use line commands to invoke CA Plan Analyzer utility functions or reports from the Compare Explain Versions panel. The line command you choose must be appropriate for the object to use it on.

The following list shows the line commands that are available from the Compare Explain Versions Select panel. To determine the commands valid for a particular line, use the online help. For more information, see Accessing Online Help.

■ ACC-Access Display

■ B-Bind

■ BO-Bind with Options

■ BR-Bind Parameters

■ D-Plan or Package Detail

■ DEP-Dependency Display

■ DI-Diagram Display

■ DP-Plan or Package Dependency

■ DR-DBRM Detail

■ E-Plan or Package Explain

■ EDIT-Edit SQL

■ F-Free

Chapter 7: Comparing Explain Versions 145

Page 146: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing Online Help

146 User Guide

■ INFO-Display INFO Database

■ L-Plan or Package List

■ OBJ-Object Report

■ PERF-Performance Database Display

■ PI-Package Inclusion

■ PP-Plan Packlist

■ PRED-Predicate Analysis

■ QE-Quick Explain

■ R-Rebind

■ RES-Reset

■ RO-Rebind with Options

■ RR-Rebind Parameters

■ ST-Plan or Package SQL Statement

■ STAT-Statistics Report Display

■ UA-User Authorization

■ X-Explode

Accessing Online Help To display a list of all valid line commands, enter a question mark (?) in the line command field and press Enter.

Page 147: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 8: Updating Expert System Rules

This section contains the following topics:

Rules Database (see page 147) Default Rule Sets (see page 151) Creating Rule Sets (see page 152) Templating Rule Sets (see page 153) Viewing and Updating Existing Rule Sets (see page 154) Deleting Rule Sets (see page 155) Filtering the Rules List (see page 155) Changing the Activation Status of Rules (see page 155) Setting the Notify Option (see page 156) Printing Rule and Recommendation Text (see page 158) Viewing Rule Violation Notifications (see page 159) Using the Expert System Rules Exit (see page 159)

Rules Database CA Plan Analyzer includes the Expert System to automate the intelligent evaluation of your SQL statements and the underlying physical object configurations. This system is a rule-based artificial intelligence application that analyzes your DB2 plans and alerts you to potential trouble spots. The Expert System rules also provide recommendations on how to improve your SQL and physical object configurations.

Note: CA SQL-Ease uses the same Expert System rules as CA Plan Analyzer. When you change the rules in one product, you change them for both.

When you use the CA Plan Analyzer Quick Explain or Explain Strategy options, you can specify the rule set to use. CA Plan Analyzer then uses the specified rule set to evaluate the SQL and underlying physical objects. For more information, see the chapter “Using Quick Explain and Explain Strategy Services.”

Chapter 8: Updating Expert System Rules 147

Page 148: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Rules Database

The Expert System rules are stored in a rules database. The rules database consists of four types of rules, and each rule consists of a rule number and a message. The following describes the rule groups:

SQL rules (0001-0999)

Identify potential problems that are found in your SQL. For example, SQL rules can help you identify poorly coded predicates that are not taking advantage of an existing index.

Physical design rules

Identify potential problems with the objects on which your SQL operates. For example, physical design rules can help you identify indexes with an excessive leaf distribution.

Plan rules

Identify potential problems with how your plans and packages are bound, and flag any plans or packages that are inoperative or invalid.

Predicate rules

Identify potential problems with your SQL predicates. For example, predicate rules can help you identify poorly coded predicates that are not taking advantage of an existing index.

A rule set is a complete collection of SQL, physical design, plan, and predicate rules that is applicable to a specific version of DB2. CA Plan Analyzer provides a default rule set for each DB2 version. The rule set to which rules belong partially depends on the DB2 version of the rule set SSID.

Note: For a list of the default rules, see the CA Plan Analyzer Reference Guide.

Customizing Rules

You can use the Update Expert System Rules option to create customized rule sets. The customization of the Expert System rules database is an optional process, but the physical rules are discarded when the rule set is not customized.

148 User Guide

Page 149: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Rules Database

Using the Update Expert System Rules option, you can customize:

Updatable threshold values

Several rules contain thresholds that set limitations for a rule. For rules that contain threshold values, you can update the value of the threshold. For example, a rule could specify that an index must be created after a table has n pages. n represents the threshold value. You can update the value of n to meet the needs of your site.

All threshold values are set to default values until you change them. The default threshold values have been defined to work best within a typical installation.

Severity codes

For rules that contain threshold values, you can specify severity codes. Severity codes are used when any Expert System rule is violated. The highest severity code CA Plan Analyzer encounters when you execute the batch input is the return code for the job.

Note: The value must be numeric and between 0 and 4095.

Active/inactive rules

To customize the status of a rule, you designate whether the rule must be active or inactive. For example, you can activate a rule that specifies when a clustering index must be used. When a rule set is first created, all rules within the rule set are active.

Updating Thresholds and Severity Codes

Use the Update Rule Thresholds/Severity Code panel to update the values for individual rules.

Note: CA SQL-Ease uses the same Rules panels for its rule functions.

To update thresholds and severity codes

1. Access the Rule Set Maintenance panel.

2. Enter U in the line command field next to the rule set in which to update threshold and severity code values.

3. Press Enter.

The Rules List panel appears.

4. Enter U in the line command field next to the rule that contains the threshold and severity code values to change.

5. Press Enter.

The Update Rule Thresholds/Severity Code panel appears.

6. Clear any threshold values that you are changing and enter new values.

Chapter 8: Updating Expert System Rules 149

Page 150: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Rules Database

7. Specify a value for Severity Code.

8. Press Enter.

CA Plan Analyzer saves the changes and the Rules List panel displays.

DB2 Versions Supported

When you create a rule set, CA Plan Analyzer copies the default rule set that applies to the specified DB2 version and displays the copied rules. For example, when you specify a DB2 V7.1 subsystem, only those rules that apply to DB2 V7.1 display.

You can create different rule sets for each of your DB2 subsystems, or even for specific applications.

If you are upgrading your version of DB2, you must customize and run the following:

HLQ.SRCLIB(PPAUDRxx) SQL ...

where xx is the DB2 version to which you are upgrading. This makes sure that your version of DB2 is updated for Expert Rules.

How Rule Sets Are Used

When you use the Quick Explain or Explain Strategy Services options, you can specify a rule set from the data editor panels or Explain Options panel. For example, from the Quick Explain Data Editor panel, you can specify a rule set in the Target SSID and Target Rule Set fields.

Note: For more information, see the CA Plan Analyzer Reference Guide.

When you execute the enhanced explain, CA Plan Analyzer analyzes your SQL statements and underlying objects using the specified rule set and displays any violated rules for the reports you select.

The violated rules are accompanied by recommendations on how to fix the problems. For example, suppose your PROD rule set contains a rule that a table cannot have more than 8,000 pages unless it uses an index. When you use CA Plan Analyzer Quick Explain, specify the PROD rule set. CA Plan Analyzer analyzes your SQL statements and underlying objects according to the PROD rule set. When a table has 9,000 pages and no index, CA Plan Analyzer displays the violated rule and suggests a way to correct the violation.

150 User Guide

Page 151: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Default Rule Sets

Panel Flow

You can create, update, template, or delete rule sets from the Rule Set Maintenance panel. The following summarizes the panel flow:

You can manipulate more than one rule set at once from the Rule Set Maintenance panel. For example, you can create a rule set, update another rule set, and delete an existing rule set at one time. CA Plan Analyzer always executes the command to create a rule set first. After the rule set has been created, CA Plan Analyzer executes the remaining update and deletes commands in the order they are listed on the Rule Set Maintenance panel.

Default Rule Sets CA Plan Analyzer provides default rule sets for each version of DB2. When you do not specify a rule set for EXPLAIN processing, CA Plan Analyzer uses the default rule set for the target SSIDs DB2 version.

You can also define your own default rule sets for use during EXPLAIN processing. You can define a different default rule set for each DB2 target SSID. When you do not specify a rule set for EXPLAIN processing and have previously defined @DEFAULT rule sets, CA Plan Analyzer uses the user-defined rule sets.

Chapter 8: Updating Expert System Rules 151

Page 152: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Rule Sets

You create a default rule set as you would create any rule set. However, the default rule set name must follow the form ssid.@DEFAULT, where ssid is the target SSID. For more information, see the Creating Rule Sets section.

Note: We recommend that you create a @DEFAULT rule set for each subsystem. CA Plan Analyzer uses these rule sets during EXPLAIN processing when you do not specifically request another rule set.

Creating Rule Sets When you create a rule set, you must specify the fully qualified rule set name from the Rule Set Maintenance panel. Optionally, you can access the Subsystem Selection panel to view a listing of valid subsystem IDs.

The Rules List panel appears after you enter the new rule set name from the Rule Set Maintenance panel. The Rules List panel lets you customize a rule set. Press PF3 (End) to return to the Rule Set Maintenance panel.

To customize threshold values and severity codes, you can access the Update Rule Thresholds/Severity Code panel from the Rules List panel. Press PF3 (End) to return to the Rules List panel.

To create a rule set

1. On the Main Menu, enter 5 in the command line and press Enter.

The Rule Set Maintenance panel appears.

2. Enter the following values in the indicated fields of the create line. For fields that have a defined list of valid values, see the online help.

■ Line command field-Enter C.

■ SSID-Specify the ID of the DB2 subsystem to which the rule set applies.

■ RULE SET-Specify a rule set name.

■ DESCRIPTION-(Optional) Indicate a description of the rule set.

■ SO-Indicate a share option for the rule set.

3. Press Enter. The Rules List panel appears.

4. Enter the following values in the indicated fields. For fields that have a defined list of valid values, see the online help.

■ Notify Userid-Indicate the user ID that must receive messages for rules that have been marked for notification.

■ Filter-Indicate a filter option to select which rules to display.

152 User Guide

Page 153: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Templating Rule Sets

5. Line command fields next to the default rules-Indicate whether to activate or inactivate a rule and update the existing threshold values and severity codes.

6. Press Enter. All changes are written to the rules database.

7. Press PF3 (End). The Rule Set Maintenance panel displays.

Templating Rule Sets Templating a rule set involves both entering the standard create line values and selecting an existing rule set to use as a template. For example, you could select the existing rule set D51B.NEW1 and specify D51B.TEMPLATE as the new rule set. After you press Enter, CA Plan Analyzer creates D51B.TEMPLATE as an exact duplicate of D51B.NEW1.

After you press Enter, the Rules List panel displays, which lets you customize the newly created rule set.

To template a rule set

1. On the Main Menu, type 5 in the command line and press Enter. The Rule Set Maintenance panel appears.

2. Enter the following values in the indicated fields of the create line. For fields that have a defined list of valid values, see the online help.

■ Line command-Enter C.

■ SSID-Specify the ID of the DB2 subsystem to which the rule set applies.

■ RULE SET-Specify a rule set name.

■ DESCRIPTION-(Optional) Indicate a description of the rule set.

■ SO-Indicate a share option for the rule set.

3. In the line command field next to the existing rule set that to use as a template, enter T.

4. Press Enter. CA Plan Analyzer creates the new rule set and the Rules List panel appears.

Chapter 8: Updating Expert System Rules 153

Page 154: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Viewing and Updating Existing Rule Sets

5. Customize the new rule set by altering any of the following information:

■ User ID specified in the Notify Userid field

■ Filter option

■ Activation status of the rules

See the Changing the Activation Status of Rules section for more information.

■ Threshold values

■ Severity codes

6. Press Enter. All changes are written to the rules database.

7. Press PF3 (End). The Rule Set Maintenance panel appears.

Viewing and Updating Existing Rule Sets After you create a rule set, you can use the U line command to select it for viewing or update. CA Plan Analyzer displays its current rules, thresholds, and severity codes, letting you modify them.

To update a rule set

1. On the Main Menu, enter 5 in the command line and press Enter.

The Rule Set Maintenance panel appears.

2. In the line command field next to the rule set that to update, enter U.

3. Press Enter. The Rules List panel displays with the rule set you selected. To adjust what rules are displayed, refer to the section on Filtering the Rules List.

4. Update the rule set by altering any of the following information. See the online help for descriptions of the corresponding fields.

■ Share option

■ Description

■ User ID specified in the Notify Userid field

■ Filter option

■ Activation status of the rules

For more information, see Changing the Activation Status of Rules.

■ Threshold values.

■ Severity codes.

5. Press Enter. All changes are written to the rules database.

6. Press PF3 (End). The Rule Set Maintenance panel appears.

154 User Guide

Page 155: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting Rule Sets

Deleting Rule Sets Use the D line command to delete an existing rule set. CA Plan Analyzer immediately deletes the rule set and removes it from the Rule Set Maintenance panel.

Note: You can recreate, but not recover, a deleted rule set.

To delete a rule set

1. On the Main Menu, enter 5 in the command line and press Enter. The Rule Set Maintenance panel appears.

2. In the line command field next to the rule set to delete, enter D.

3. Press Enter.

CA Plan Analyzer deletes the rule set from the database and removes it from the Rule Set Maintenance panel.

Filtering the Rules List Use the Filter field on the Rules List panel to indicate the rules to display.

To filter the rules list

1. In Filter on the Rules List panel, indicate the rules to view.

For more information, see the online help.

2. Press Enter.

The rules display that satisfy the criterion you specified.

Changing the Activation Status of Rules Two primary commands, ACTIVATE and INACTIVATE, are available for use on the Rules List panel. These commands, when used with the Filter option, let you activate or inactivate whole or partial rule sets based on the criteria specified in Filter.

You can also use the Filter field with a blank command line to specify the rules to be displayed.

Chapter 8: Updating Expert System Rules 155

Page 156: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Setting the Notify Option

To activate all displayed rules

1. On the Rules List panel, display the rules that to activate.

For more information, see Filtering the Rules List.

2. Enter ACTIVATE on the command line.

3. Press Enter.

CA Plan Analyzer activates the displayed rules.

To activate individual rules

1. On the Rules List panel, display the rules for the rule set.

For more information, see Filtering the Rules List.

2. Locate the rule to activate.

3. In the line command field next to the rule number, enter A.

4. Press Enter.

CA Plan Analyzer activates the rule.

To inactivate all displayed rules

1. On the Rules List panel, display the rules that to inactivate.

For more information, see Filtering the Rules List.

2. Enter INACTIVATE on the command line.

3. Press Enter.

CA Plan Analyzer inactivates the displayed rules.

To inactivate individual rules

1. On the Rules List panel, display the rules for the rule set.

For more information, see Filtering the Rules List.

2. Locate the rule to inactivate.

3. In the line command field next to the rule number, enter I.

4. Press Enter.

CA Plan Analyzer inactivates the rule.

Setting the Notify Option The notification feature lets you indicate whether to send a message to another user each time a rule is violated. CA Plan Analyzer sends the message to a user ID that you specify for a particular rule set. Use this feature to get information about rule violations that are critical to your system performance.

156 User Guide

Page 157: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Setting the Notify Option

The first step in setting up the feature is to specify the user ID that must receive the message. To do this, use Notify Userid on the Rules List panel.

The next step is to indicate which rules must trigger the message. You can set rules to trigger the message for individual rules or, by the use of primary commands, for all the rules in a rule set.

To setting notification for individual rules

1. Access the Rule Set Maintenance panel.

2. Enter U in the line command field next to the rule set in which to set notification.

3. Press Enter.

The Rules List panel appears.

4. In Notify Userid, type the ID of the user to notify when rule violations occur.

Note: CA Plan Analyzer sends the notifications as TSO Send commands. To receive these notifications, you must configure your TSO environment appropriately.

5. Enter U in the line command field next to the individual rule that you want set to trigger the message.

6. Press Enter.

The Update Rule Thresholds/Severity Code panel appears.

7. In Notify Option, indicate whether to send a message when the rule is violated.

8. If you entered Y in Notification Option, enter a value in the Severity Code field. If you entered N in Notification Option, skip to step 9.

9. Press Enter.

CA Plan Analyzer saves the changes and returns you to the Rules List panel.

10. Press PF3 (End) to save the changes and return to the Rule Set Maintenance panel.

To set notification for all the rules in a rule set

1. Access the Rule Set Maintenance panel.

2. Enter U in the line command field next to the rule set in which to set notification.

3. Press Enter.

The Rules List panel appears.

Chapter 8: Updating Expert System Rules 157

Page 158: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Printing Rule and Recommendation Text

4. Display the rules for which to set notification.

For more information, see Filtering the Rules List.

5. Perform one of the following:

■ To turn on rule violation notification for each displayed rule, type NOTIFYON in the command line.

■ To turn off rule violation notification for each displayed rule, type NOTIFYOFF in the command line.

Note: The use of NOTIFYON and NOTIFYOFF overrides any individual rule values specified in the Notify Option field on the Update Rule Thresholds/Severity Code panel.

6. Press Enter.

All displayed rules are updated according to the command you entered.

7. Press PF3 (End) to return to the Rule Set Maintenance panel.

8. Press PF3 (End) to save the changes and return to the Main Menu.

Printing Rule and Recommendation Text Printing the rules and recommendations provides a convenient way to review the rule content and threshold settings.

To print the rule and recommendation text

1. On the Rules List panel, display the rules that to print.

To display the complete rule set, set the Filter to '*'.

For more information, see the procedure described in the section on Filtering the Rules List.

2. Enter one of the following common products print commands:

■ QPRINT - Print current report in its entirety.

■ PPRINT - Print the portion of the report currently displayed on the panel.

■ QFILE - Write entire report to a data set.

■ PFILE - Write displayed portion of the report to a data set.

Note: For more information, see the General Facilities Reference Guide.

158 User Guide

Page 159: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Viewing Rule Violation Notifications

Viewing Rule Violation Notifications When rules violations occur, the user ID you specified in Notify Userid on the Rule Set Maintenance panel receives the notifications. CA Plan Analyzer sends the notifications as TSO Send commands. To receive these notifications, you must configure the TSO environment appropriately.

The following shows sample notification messages:

+Rule #0010-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #0016-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #0078-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #1001-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #1006-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #1011-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

+Rule #1029-123456 Collid: PPA0107 Package: PPA$KR23 Stmt: 529

The format of the message depends on the source type of the explain in which the rule was violated. The messages are listed in numeric order by SQL statement number, and a notification message appears for each violation of a specified rule.

Using the Expert System Rules Exit The CA Plan Analyzer Expert System Rules Exit lets you intercept rules, indicate whether to display rules, change the severity code of the rules, and add customized text when the rules are displayed. You do this with a user-written exit. This section describes how to activate and use the Expert System Rules Exit option and provides a sample exit.

Activating the Exit

The Expert System Rules Exit is controlled through the PARMLIB keyword USEREXIT. This option applies to all rule types: plan rules, SQL rules, physical rules, and predicate rules.

When the user-defined rules option is turned on, the user-written exit is called on three different occasions for each SQL statement. The following list describes the calls:

The initial call

At the time of the initial call, you can initialize your own program or perform any other functions that are appropriate for this stage of the process.

Chapter 8: Updating Expert System Rules 159

Page 160: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

The rule call

A rule call is made every time a rule is triggered. At this time you have the options of displaying the rule, adding text to be printed after each recommendation, and changing the severity code.

The final call

A final call lets you free up storage you have get-mained in the initial call. At this point you must also perform any other cleanup required for your exit program.

When one of these calls occurs, CA Plan Analyzer invokes the object module PPAEXIT.

Object Module PPAEXIT

The Expert System Rules Exit routine is stored in the object module PPAEXIT. CA Plan Analyzer invokes this module when a call to the exit occurs. PPAEXIT is the only currently supported entry point.

Within the exit routine, you can execute any SQL statement. The exit routine uses standard register calling conventions. You can see an example of an exit routine in the Sample Exit - PPAEXIT section.

After an Expert System Rules Exit has been called and executed, PPAEXIT passes a return code value to the Enhanced Explain processor. The value set in this return code determines the action to be taken. The following describes the possible return code values:

■ 0-Trigger the rule.

■ 8-Do not trigger the rule.

■ 99-Processing error.

■ -1-Turn off user exit.

Linking the Object Module

To implement this feature and support a rules exit, you must include the member of the PPAEXIT entry point when you link the CA Plan Analyzer modules.

160 User Guide

Page 161: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

A special link member, LNKPPAEX, in highlvl.SRCLIB links the PPAEXIT object module, which creates the load member PPLEXIT. You can relink PPAEXIT at any time to change your rule exit processing. The PPLEXIT member must be stored in an MVS authorized library. CA Plan Analyzer loads the PPLEXIT member at initialization time.

Note: The required job card information must be included in member LNKPPAEX.

Expert System Rules Exit Communications Block

R1 points to a fullword containing the address of the communications block. The communications block definitions are supplied for assembler. These definitions reside in member PPMEXIT in highlvl.SRCLIB.

SQL Rule Number Table

The following table shows, by SQL rule, the fields in PPMEXIT that you can expect to be filled. If a field does not contain an X, nothing is passed into that control block when the rule is set off.

Note: For Plan Rules (2000 series) and Predicate Rules (3000 series), none of the fields in the control block are filled.

Sql Rule Number

EXIT_ COLUMN1_ LONG

EXIT_ COLUMN2_ LONG

EXIT_ TABLE1_LONG

EXIT_ TABLE2_LONG

EXIT_ DBNAME

EXIT_ TSPACE

EXIT_ INDEX_ LONG

EXIT_ VIEW_ LONG

0001

0002 X X X X

0003 X X X X

0010 X

0011

0012

0013

0014 X

0015 X

0016

0017

0018

Chapter 8: Updating Expert System Rules 161

Page 162: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

162 User Guide

Sql Rule Number

EXIT_ COLUMN1_ LONG

EXIT_ COLUMN2_ LONG

EXIT_ TABLE1_LONG

EXIT_ TABLE2_LONG

EXIT_ DBNAME

EXIT_ TSPACE

EXIT_ INDEX_ LONG

EXIT_ VIEW_ LONG

0019

0059

0060

0061

0063 X

0064

0065

0066

0067

0069

0070 X X

0071 X X

0072 X X

0073

0074

0075

0076

0076

0077 X

0078

0079 X

0081

0082 X X X

0083 X

0084

0085

0086 X X

0087

Page 163: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

Chapter 8: Updating Expert System Rules 163

Sql Rule Number

EXIT_ COLUMN1_ LONG

EXIT_ COLUMN2_ LONG

EXIT_ TABLE1_LONG

EXIT_ TABLE2_LONG

EXIT_ DBNAME

EXIT_ TSPACE

EXIT_ INDEX_ LONG

EXIT_ VIEW_ LONG

0088 X X X

0089

0090

Physical Rule Number

The following table shows, by Physical Number rule, the fields in PPMEXIT that you can expect to be filled. If a field does not contain an X, nothing is passed into that control block when the rule is set off.

Physical Number Rule

EXIT_ COLUMN1

EXIT_ COLUMN2

EXIT_ TABLE1

EXIT_ TABLE2

EXIT_ DBNAME

EXIT_ TSPACE

EXIT_ INDEX

EXIT_ VIEW

1001 X

1002 X X X

1003 X X

1004 X X X

1005 X X X

1006 X X X

1007 X X X

1008 X X X

1009 X X X

1010 X X X

1011 X X X

1012 X X

1013 X X X

1014 X X X

1015 X X X

1016 X X X

1017 X X X

Page 164: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

164 User Guide

Physical Number Rule

EXIT_ COLUMN1

EXIT_ COLUMN2

EXIT_ TABLE1

EXIT_ TABLE2

EXIT_ DBNAME

EXIT_ TSPACE

EXIT_ INDEX

EXIT_ VIEW

1018 X X X

1019 X X

1020 X X X

1021 X X X

1022 X

1023 X X

1024 X X

1025 X X X X

1026 X X X

1029 X

1030 X

1031 X X

1032 X X

1033 X X

1034 X X

1035 X X

1053 X X X

1054

1055

1056 X

1057 X

1058 X

1059 X

1060 X

1061 X

Page 165: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using the Expert System Rules Exit

Chapter 8: Updating Expert System Rules 165

Sample Exit - PPAEXIT

A sample exit, PPAEXIT, is provided in highvl.SRCLIB. You can modify this exit to meet your specific needs.

This routine is called whenever the SQL design rule number 0074 or the physical design rule number 1008 is encountered. When rule number 0074 is invoked, the PPAEXIT routine adds additional recommendation text and changes the severity code to 99. When rule number 1008 is invoked, this user exit routine prevents the rule from displaying when the creator of the table is SYSIBM.

Page 166: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 167: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 9: Using Reporting Services

This section contains the following topics:

Accessing a Reporting Service (see page 167) Understanding Header Field Guidelines (see page 168) Using Wildcard Characters in Header Fields (see page 171) Generating Reports Online (see page 171) Scrolling Through Reports (see page 172) Switching Among Reports (see page 172) Controlling Report Hierarchy Display (see page 173)

Accessing a Reporting Service This section describes how to use the CA Plan Analyzer Reporting Services.

Note: For more information, see the CA Plan Analyzer Reference Guide.

The CA Plan Analyzer Reporting Services eliminates the need to write complex queries by giving you five powerful options to monitor your plans, DBRMs, packages, objects, and SQL statements. Plan Reporting, DBRM Reporting, Package Reporting, Object Reporting, and Statement Reporting supply many different reports that provide information not available from the DB2 system catalog.

These five reporting features are linked to let you generate the same report for different plans, DBRMs, packages, objects, or statements from within the report itself.

All reports support Distributed Data Facility (DDF) locations. By letting you change the Location and DB2 SSID on any report panel, CA Plan Analyzer provides a method for navigating through many DB2 subsystems. You can produce reports in online or batch mode. You can also extend the WHERE clause on any of the SQL statements by using the Extended Query Facility (EQF).

Note: This chapter describes how to generate reports online. However, you can also generate reports in batch. For more information, see the chapter “Using Batch Reporting.”

Chapter 9: Using Reporting Services 167

Page 168: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Header Field Guidelines

You can access all reporting services from the Main Menu.

To access a reporting service

1. On the command line of the Main Menu, enter the option number of the particular reporting service to use. Valid options are:

■ 6-For Plan Reporting

■ 7-For DBRM Reporting

■ 8-For Package Reporting

■ 9-For Object Reporting

■ 10-For Statement Reporting

2. Press Enter.

The reports menu displays for the reporting service you selected.

Understanding Header Field Guidelines The effects of header fields vary slightly from one reporting service to another. This section explains the guidelines for the header fields.

For All Reporting Services

For the plan, DBRM, package, and object reporting services, you must specify both an option and report. For the statement reporting service, you must specify only one option.

By default, the Option field contains the value that represents the current reporting service. When to switch to a different reporting service, change the value in Option. For more information, see Switching Among Reports.

When you first access a reporting service, the Report field is blank. You must specify an available report for the reporting service. A list of the available reports appears on the reporting service's Reports Menu and in the online help.

Note: Wildcard characters are not valid in the Option and Report fields.

168 User Guide

Page 169: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Header Field Guidelines

For Plan Reporting

To generate plan reports, you must also specify selection criteria for the names and creator IDs of the available plans. In Name and Creator, you can use wildcard characters to specify plan names or creator IDs that match a certain naming convention, to select all plans with a certain name, or to select all plans created using a particular creator ID. For more information, see Using Wildcard Characters in Header Fields.

For DBRM Reporting

Similar to generating plan reports, you must also specify selection criteria for the names and creator IDs of the available DBRMs. In Name and Creator, you can use wildcard characters. For more information, see Using Wildcard Characters in Header Fields.

For Package Reporting

To generate package reports, you must also specify selection criteria for collection IDs and package names. In Collection and Package, you can use wildcard characters. For more information, see Using Wildcard Characters in Header Fields.

For Object Reporting

Unlike the plan, DBRM, and package reporting services, the object reporting service generates reports about dependencies on objects, rather than about objects themselves. So, when you select a report and specify selection criteria in the header fields, only the plans, DBRMs, and packages that are dependent on the database, tablespace, or other object are reported.

Chapter 9: Using Reporting Services 169

Page 170: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Header Field Guidelines

Use the following fields to specify information about the referenced and referencing objects. You can use wildcard characters in these fields. See the Using Wildcard Characters in Header Fields section for more information.

Name and Creator

Indicate the name and creator ID of the referenced objects you want included in the report.

Plan and DBRM

Indicate the names of the plans and DBRMs referencing the objects that match the criteria specified in Name and Creator.

Collid and Package

Indicate the names of the collections and packages to be searched for the objects that match the criteria specified in Name and Creator.

In addition to selecting a report and specifying information about the referenced and referencing objects, you must also indicate in Type whether you want that report to present summary or detail information. Wildcard characters are not accepted in this field.

For Statement Reporting

Unlike the other reporting services, Statement Reporting does not require a value in the Report header field. However, you must use the following fields to specify additional information:

Scope

Indicate whether the report must contain only plans, only packages, or both plans and packages.

Plan/Collid and DBRM/Package

Indicate the names of the objects in which to search for SQL statements. Depending on the value you specified in Scope, the values in these fields correspond to plans, packages, or both.

You can use wildcard characters in Plan/Collid and DBRM/Package. For more information, see Using Wildcard Characters in Header Fields.

Note: When you switch from Statement Reporting to another reporting service, the values in Plan/Collid and DBRM/Package become the values in the Name and Creator fields (or the Collection and Package fields), respectively. Conversely, when you switch to Statement Reporting from another reporting service, the values in Name and Creator (or the Collection and Package fields) become the values in the Plan/Collid and DBRM/Package fields, respectively.

170 User Guide

Page 171: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Wildcard Characters in Header Fields

Using Wildcard Characters in Header Fields You can use any of the standard wildcard characters-asterisk (*), percent sign (%), and underscore (_)-in the header fields, unless otherwise noted in this chapter or the online help.

Note: For more information, see the General Facilities Reference Guide.

Generating Reports Online Depending on the type of report to generate, you must specify different types of criteria, but the general procedure for generating the reports is similar for all reporting services. See the online help for more information about the fields in the following procedures that have a defined list of valid values.

Note: You can also generate the reporting services reports in batch. For more information, see the chapter “Using Batch Reporting.”

To generate a plan, DBRM, package, or object report

1. Access the reporting service to use.

For more information, see Accessing a Reporting Service.

2. On the reports menu, complete the header fields based on the type of report you want. For information about the header fields for the reporting service you selected, see the Understanding Header Field Guidelines and Using Wildcard Characters in Header Fields sections for more information.

Note: If you requested a Plan Explain or Package Explain report, continue with step 3. If not, continue with step 4.

3. Press Enter.

An additional header field displays called Creator, which specifies the name of the PLAN_TABLEs used to store the explain output.

4. Press Enter.

The report matching the specified criteria displays.

To generate a statement report

1. Access the statement reporting service.

For more information, see Accessing a Reporting Service.

2. On the reports menu, complete the header fields.

For more information, see Understanding Header Field Guidelines and Using Wildcard Characters in Header Fields.

Chapter 9: Using Reporting Services 171

Page 172: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Scrolling Through Reports

3. Choose Statement Types-Enter S next to the types of statements on which to report.

4. Choose one or more elements to search for-Indicate the element conjunction to use.

5. (Optional) In the list of syntax elements, enter S next to one or more syntax elements to further limit the SQL statements on which to report.

6. Press Enter.

The report displays with the SQL statements matching the specified criteria.

Scrolling Through Reports You can use function keys or primary commands to scroll across and down reports.

■ Use PF10 (Left) or PF11 (Right) to scroll across a report that exceeds a single panel in width.

■ Use PF7 (Up) or PF8 (Down) to scroll through a report that exceeds a single panel in length.

Switching Among Reports CA Plan Analyzer lets you switch among reports for a different object type (such as from a plan report to a package report) or for the same object type (such as from a plan report to another plan report).

Note: When you switch from Statement Reporting to another reporting service, the values in Plan/Collid and DBRM/Package become the values in the Name and Creator fields (or the Collection and Package fields), respectively. Conversely, when you switch to Statement Reporting from another reporting service, the values in Name and Creator (or the Collection and Package fields) become the values in the Plan/Collid and DBRM/Package fields, respectively.

To switch to a report for a different object type

1. Generate a report.

For more information, see Generating Reports Online.

2. In the Option field, indicate the reporting service to use.

3. In the Report field, indicate the report to switch to.

For more information, see the online help.

Note: If you requested a Plan Explain or Package Explain report, continue with step 4. If not, go to step 5.

172 User Guide

Page 173: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

4. Press Enter.

An additional header field displays called Creator, which specifies the name of the PLAN_TABLEs used to store the explain output.

5. Press Enter.

The report displays matching the specified criteria.

To switch to a report for the same object type

1. Generate a report.

For more information, see Generating Reports Online.

2. In the Report field, indicate the report to switch to.

For more information, see the online help.

Note: If you requested a Plan Explain or Package Explain report, continue with step 3. If not, go to step 4.

3. Press Enter.

An additional header field displays called Creator, which specifies the name of the PLAN_TABLEs used to store the explain output.

4. Press Enter.

The report displays matching the specified criteria.

Controlling Report Hierarchy Display The information and procedures described in this section apply only to the object and statement reporting services.

Determining the Initial Hierarchical Level

You can expand and collapse the SQL statement display in an object dependency report or statement report using the EXPLODE primary command or X line command. Unlike the corresponding commands in the Query Explain Database, Compare Explain Versions, Source Database Maintenance, and Identify Problem SQL facilities, the explode commands act as toggles between expanded and collapsed displays of information.

Your CA Plan Analyzer profile determines the initial state of an object dependency or statement report. When the value for Explode SQL ON/OFF in your CA Plan Analyzer profile is set to Y, the report initially displays in expanded state. When the value for this field is set to N, the report initially displays in truncated state.The default for this field is N.

For more information, see the chapter “Maintaining Profiles.”

Chapter 9: Using Reporting Services 173

Page 174: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The explode commands determine how SQL statements are presented in a dependency or statement report. An SQL statement can appear in an expanded (EXPLODE ON) state or a collapsed (EXPLODE OFF) state. In an expanded state, SQL statements are displayed in full. In a truncated state, only a portion of each SQL statement is displayed.

Understanding the Hierarchical Display

The object dependency and statement reports show the hierarchical relationships among various database objects. The following shows a sample object dependency report hierarchical display:

PPORTS --------- Tablespace Dependency (Det) ---------- COMMAND ===> SCROLL ===> CSR Option ===> O Report ===> TS Name ===> PTCODETS Creator ===> * Where ===> N Plan ===> MKT001BE DBRM ===> * Type ===> D Collid ===> * Package ===> * ---------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD Tablespace Plan/Collection DBRM/Pkg Stmt SQL STATEMENTS ____ PTCODETS ____ MKT001BE ____ MKT001BE ____ 1018 SELECT PT_ENT_LST_EMP_NU ____ 1083 SELECT PT_IND_CODE_O,PT_ ____ 1146,SELECT PT_SHR_CODE_O,PT_ ____ 1230,SELECT PT_TSC_CODE_O,PT_ ____ 1265,SELECT PT_PLN_CODE_O,PT_ ____ 1301,SELECT PT_TRN_CODE_O,PT_

174 User Guide

Page 175: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The following describes the hierarchical fields that appear on every object dependency report. All fields are for display only.

Referenced object name

The names of the referenced objects of the type for which you generated this dependency report. For example, in the preceding illustration the referenced object is Tablespace. Valid object types are:

■ Database

■ Tablespace

■ Table

■ Index

■ View

■ Synonym

■ Alias

■ Column

Plan/Collection

The names of the plans or collections that match the header criteria and reference the object name displayed in the referenced object column.

In the hierarchy display, plans and collections are shown immediately following the referenced object.

DBRM/Pkg

The names of the DBRMs or packages that match the header criteria, are referenced by the plan or collection name displayed in Plan/Collection and reference the object name displayed in the referenced object column.

In the hierarchy display, DBRMs and packages are shown immediately following the plans and collections.

Stmt

The number of the SQL statement that references the object displayed in the referenced object column.

In the hierarchy display, SQL statements are shown immediately following the DBRMs and packages.

SQL statements

The text of the SQL statement that references the object displayed in the referenced object column.

Chapter 9: Using Reporting Services 175

Page 176: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The following shows a sample statement report hierarchical display:

r11.5 ----------- PPA SQL Statement Report ----------- COMMAND ===> SCROLL ===> CSR Option ===> ST Report ===> Scope ===> B Plan/ DBRM/ Collid ===> PLANXXXX Package ===> * Where ===> N ----------------------------------------------------------------- XXXXXXXX Location ===> LOCAL DB2 SSID ===> D81A Version ===> V8R1M0 CMD PLAN COLLID DBRM/PKG STMTNO SQL STATEMENTS ____ PLANXXXX ____ (DB) PPA$PTA ____ 529 SELECT COUNT ( * ) ____ INTO :H_COUNT ____ FROM SYSIBM.SYSCOLUMNS ____ WHERE TBNAME = 'PLAN_TA> ____ :H_CREATOR_LN ____ 535 SELECT COUNT ( * ) ____ INTO :H_COUNT ____ FROM SYSIBM.SYSCOLUMNS

The following describes the hierarchical fields that appear on every statement report. All fields are for display only.

PLAN

(For reports that display only packages or both plans and packages) The names of the plans matching the criteria in the header fields and containing SQL statements with the syntax elements you selected.

When the value for Scope is B or P, the Plan column is included on the statement report.

COLLID

(For reports that display only packages or both plans and packages.) The names of the collections matching the criteria in the header fields and containing SQL statements with the syntax elements you selected.

176 User Guide

Page 177: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

DBRM/PKG

(For reports that display only plans.) Indented and immediately following the plan name, the names of the DBRMs matching the header criteria and containing SQL statements with the syntax elements you selected.

(For reports that display both plans and packages.) Indented and immediately following the collection name, the names of the packages matching the header criteria and containing SQL statements with the syntax elements you selected.

(For reports that display only packages.) Indented and immediately following the collection name, the names of the packages matching the header criteria and containing SQL statements with the syntax elements you selected.

STMTNO

The number of the SQL statement that contains the syntax elements you selected. In the hierarchy display, SQL statements appear indented and immediately following the DBRMs and packages.

SQL STATEMENTS

The text of the SQL statement that contains the syntax elements you selected.

Changing the SQL Statement State

You can use the EXPLODE primary command and X line command to toggle between exploded and truncated displays of object dependency and statement reports. The EXPLODE primary command lets you expand or truncate the entire report, whereas the X line command lets you expand or truncate the selected line and all its dependent lines. The EXPLODE primary command overrides any X line commands.

For example, suppose the current report display state is truncated. You can expand several SQL statements by entering X in the line command fields next to these statements. After you press Enter, the selected lines expand, but the report display state of the report remains EXPLODE OFF.

When you enter EXPLODE on the command line, the SQL statements for the entire report expand. The SQL statements that were individually expanded remain in an expanded state because the EXPLODE primary command overrides any executed X line commands. According to the EXPLODE primary command, the display state of the selected lines has not changed.

To explode or truncate reports globally, first display a report, then enter EXPLODE on the command line and press Enter. The report redisplays showing the information in the alternate display state.

Chapter 9: Using Reporting Services 177

Page 178: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

To explode or truncate selected report lines, first display a report, then enter X in the line command field next to the object or SQL statement for which to change the display state. Press Enter. The report redisplays showing the object or statement you selected in the alternate display state. For objects, all dependent lines are also shown in the alternate display state, expanded or truncated.

Object Dependency Report Examples

The following shows the initial display of SQL statements in an object dependency report when using the default profile value of EXPLODE OFF. Notice that the SQL statements are truncated so that only a portion of each SQL statement displays.

PPORTS --------- Tablespace Dependency (Det) ---------- COMMAND ===> SCROLL ===> CSR Option ===> O Report ===> TS Object ===> PTITSPAC Creator ===> * Where ===> N Plan ===> PPAM0104 DBRM ===> * Type ===> D Collid ===> * Package ===> * ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD Tablespace Plan/Collection DBRM/Pkg Stmt SQL STATEMENTS ____ ____ PTITSPAC ____ PPAM0104 ____ PPA$CEVC ____ 2255 SELECT SEQNO , "PLAN" ____ 2279 SELECT SEQNO , "PLAN" ____ PPA$ESM ____ 1439 DELETE FROM PTI.PTPA_ ____ 1474 DELETE FROM PTI.PTPA_ ____ PPA$QEDA

178 User Guide

Page 179: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

The following shows the same object dependency report in an exploded state. Notice that all SQL statements are displayed in full.

PPORTS --------- Tablespace Dependency (Det) ---------- COMMAND ===> SCROLL ===> CSR Option ===> O Report ===> TS Object ===> PTITSPAC Creator ===> * Where ===> N Plan ===> PPAM0104 DBRM ===> * Type ===> D Collid ===> * Package ===> * ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 CMD Tablespace Plan/Collection DBRM/Pkg Stmt SQL STATEMENTS ____ ____ PTITSPAC ____ PPAM0104 ____ PPA$CEVC ____ 2255 SELECT SEQNO , "PLAN" ____ STMTNO , STMTTYPE ____ FROM PTI.PTPA_ES_EX ____ WHERE STRAT_NAME = ____ STRAT_CREATOR = : ____ STRAT_VERSION = :

Statement Report Examples

The following shows the initial display of SQL statements in a statement report when using the default profile value of EXPLODE OFF. Notice that the SQL statements are truncated so that only a portion of each SQL statement displays.

r11.5 ----------- PPA SQL Statement Report ----------- COMMAND ===> SCROLL ===> CSR Option ===> ST Report ===> Scope ===> B Plan/ DBRM/ Collid ===> PLANXXXX Package ===> * Where ===> N ----------------------------------------------------------------- XXXXXXXX Location ===> LOCAL DB2 SSID ===> D81A Version ===> V8R1M0 CMD PLAN COLLID DBRM/PKG STMTNO SQL STATEMENTS ____ PLANXXXX ____ (DB) PPA$PTA ____ 529 SELECT COUNT ( * ) ____ 535 SELECT COUNT ( * ) ____ V8TEST ____ (PK) V8CTEXPR ____ 18 DECLARE EXAMPLE1 CURSOR F> ____ 44 DECLARE EXAMPLE3 CURSOR F> ____ 60 DECLARE EXAMPLE4 CURSOR F> ____ (PK) V8MQPFUN

Chapter 9: Using Reporting Services 179

Page 180: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Controlling Report Hierarchy Display

180 User Guide

The following shows the same statement report in an exploded state. Notice that all SQL statements are displayed in full.

r11.5 ----------- PPA SQL Statement Report ----------- COMMAND ===> SCROLL ===> CSR Option ===> ST Report ===> Scope ===> B Plan/ DBRM/ Collid ===> PLANXXXX Package ===> * Where ===> N ----------------------------------------------------------------- XXXXXXXX Location ===> LOCAL DB2 SSID ===> D81A Version ===> V8R1M0 CMD PLAN COLLID DBRM/PKG STMTNO SQL STATEMENTS ____ PLANXXXX ____ (DB) PPA$PTA ____ 529 SELECT COUNT ( * ) ____ INTO :H_COUNT ____ FROM SYSIBM.SYSCOLUMNS ____ WHERE TBNAME = 'PLAN_TA> ____ :H_CREATOR_LN ____ 535 SELECT COUNT ( * ) ____ INTO :H_COUNT ____ FROM SYSIBM.SYSCOLUMNS

Page 181: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 10: Using Batch Reporting

This section contains the following topics:

Batch Reporting Job Submission (see page 181) Batch Reporting Model JCL (see page 183) Implementing Plan Analyzer in the Development Cycle (see page 184) Batch Input (see page 195)

Batch Reporting Job Submission The CA Plan Analyzer Batch Reporting facility lets you generate reports in batch mode. Batch Reporting creates a job stream that contains the JCL commands and control information to generate and print the reports.

Some of the advantages to Batch Reporting include:

Availability of reports

Almost all reports are available through Batch Reporting.

More efficient processing

Because the reports are generated in batch mode, they do not require your time to display and print them. Batch Reporting also lets you generate reports at night or at any other off-peak time.

Customized reports

Through the Extended Query Facility (EQF), you can create customized reports.

Batch Reporting uses the Execution Library parameters of your profile to determine the location of the load libraries. The load libraries generate the STEPLIB cards needed during batch execution. See the “Maintaining Profiles” chapter for more information.

Note: Do not confuse the CA Plan Analyzer Batch Reporting facility with the Batch Processor. The Batch Processor is a product for processing data sets that contain SQL and special Batch Processor commands. The Batch Processor commands let you dynamically call DB2 utilities and application programs, execute DB2 commands (DSN), and so on. For more information, see the Batch Processor Reference Guide.

For example, to execute a BIND from the CA Plan Analyzer Plan List report, you must use the Batch Processor. When you want a list of plans generated in batch, you can use the CA Plan Analyzer Batch Reporting facility.

Chapter 10: Using Batch Reporting 181

Page 182: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Reporting Job Submission

There are three ways to use CA Plan Analyzer in batch mode:

Batch Reporting

The CA Plan Analyzer Batch Reporting facility.

Implementing CA Plan Analyzer in the Development Cycle

You can incorporate CA Plan Analyzer into the development cycle of your application by including it in your batch jobs.

Batch Input

When combined with a job stream, you can execute online, in batch, or in immediate batch.

You can use the BATCH primary command to:

■ Access the Batch Reporting facility from Plan Reporting, DBRM Reporting, Package Reporting, Object Reporting, Statement Reporting, Identify Problem SQL, and Query Explain Database menus and reports.

■ Submit a batch reporting job.

Note: After submitting and printing the report, the last line of the printed report might indicate that the report is incomplete. This message occurs when the print line size of the report is greater than 132 or when the report contains columns normally excluded during online processing, such as QON qualifier fields.

To submit a batch reporting job

1. On any reporting facility, Identify Problem SQL, or Query Explain Database menu or report, complete the header fields.

2. Enter BATCH on the command line.

3. Press Enter.

The Batch Reporting Job Submission panel appears.

4. Enter values in the indicated fields.

For fields with a defined list of valid values, see the online help.

■ Option-Specify the options for processing the report job stream. The report job stream consists of the JCL to generate the report and the report input.

■ Action-(Optional) Indicate what action you want taken on the list of plans or packages in the report you requested.

■ JOBCARD-Specify the JOB statement to be used in generating the report.

■ SYSOUT-Specify the output class for the job.

182 User Guide

Page 183: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Reporting Model JCL

5. Press Enter.

Depending on the value you specified in Option, one of the following occurs:

■ If you entered E, the SQL Editor panel appears with the report job stream to be used for execution. You can modify the job stream. Press PF3 (End) to return to the Job Submission panel. The entire job stream appears in the report input section.

■ If you entered S, the report job stream is immediately submitted to JES.

Note: When you want the reports generated during off-peak hours, you can send the report job stream to the held queue for later execution.

■ If you entered D, the Batch Dataset Selection panel appears so you can specify the name of the Batch Processor (PBP) data set.

Press Enter.

The batch reporting job is written to the specified data set.

The Job Submission panel reappears.

Batch Reporting Model JCL CA Plan Analyzer provides default model JCL for the Batch Reporting facility and the Batch Processor. The model JCL contains the required JCL and control card necessary to generate an executable MVS job stream. You can change the default members to comply with your site standards.

Default Model JCL Parameters

The PPA PARMLIB member contains the default model JCL parameters. The default model JCL parameters are unloaded into a product library at installation time.

The following describes the supplied default model JCL parameters:

BPMODEL

Batch Processor model JCL member.

RPTMODEL

Report model JCL member.

Chapter 10: Using Batch Reporting 183

Page 184: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Implementing Plan Analyzer in the Development Cycle CA Plan Analyzer enhanced explain processing extracts and analyzes DB2 explain information from the PLAN_TABLE. You can execute enhanced explain processing online within CA Plan Analyzer or by itself in a batch job. Using enhanced explain processing within batch jobs is useful when you are applying other CA Plan Analyzer features to your application program plans and packages before the program is compiled and linked.

Batch jobs that use the enhanced explain processing can have the enhanced explain input saved as a strategy and the results of the enhanced explain saved as a strategy version. Enhanced explain input consists of the explain options and SQL sources used for CA Plan Analyzer explain processing.

You can use the CA Plan Analyzer Expert System Rules in your enhanced explain processing. This provides the added advantage of being able to control return code processing for that step of the batch job. You can assign a severity code to each individual rule. The highest severity code issued is the return code for the job.

For more information, see the chapter “Updating Expert System Rules.”

This section discusses the benefits of using the processor in batch jobs, batch job creation, strategy and version creation in batch jobs, and rule violation return codes. You must have a solid understanding of enhanced explain processing before using the Enhanced Explain processor in batch jobs.

Development Cycle Support

You can create batch jobs that implement enhanced explain processing to control the development of your application programs. For example, you can invoke enhanced explain processing after an application program is precompiled. If any Expert System Rules are violated, you could request job termination before the program is compiled and linked.

184 User Guide

Page 185: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Enhanced explain processing provides two unique options when used for batch jobs:

Strategy and version creation

When the enhanced explain input is submitted in a batch job, enhanced explain processing can create strategies and versions even when these entities were not originally created online through CA Plan Analyzer. See the Creating Strategies and Versions in Batch section for more information.

Return codes

When enhanced explain input is run in batch jobs, you can use the severity codes assigned to each rule to further control processing. The highest severity code encountered is the return code for the step. You can use the non-zero return code to stop further processing. See the Enhanced Explain Return Codes and the Sample 1 - After Precompilation sections for more information.

When you use enhanced explain processing in batch jobs, you can analyze your plans and packages throughout the entire development cycle of an application program. For example, you might want to use enhanced explain processing shortly after an application program is precompiled rather than waiting for the application program to be compiled and linked. Also, you can edit the enhanced explain input, adding or deleting requests for enhanced explain reports, SQL sources, and other options.

The following sections describe how to create the enhanced explain input. Included are implementation scenarios that demonstrate the CA Plan Analyzer integration into various stages of application program development.

Creating Enhanced Explain Input

CA Plan Analyzer automatically generates and saves enhanced explain input when you explain a strategy through CA Plan Analyzer. You can write your enhanced explain input to a batch data set using the Batch Processor. Once the data set is built, the batch job JCL needed for the enhanced explain processing is generated.

You can save, copy, and edit the created JCL. Although you can create the JCL without using CA Plan Analyzer, we recommend that you let CA Plan Analyzer initially create the JCL so that it can be used as a model for other batch job JCL. This section describes the steps required to have enhanced explain input generated and included in batch job JCL. You can use immediate batch or batch mode.

Chapter 10: Using Batch Reporting 185

Page 186: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

To use immediate batch mode

1. Request immediate batch mode by entering I in Mode from the Main Menu or by entering MODE I on the command line.

2. Specify the Batch Processor data set.

For more information, see the chapter “Introduction.”

3. Request the Explain Strategy Services option from the Main Menu.

You can request the Quick Explain option, but no strategies or versions are created when you use this option.

4. Create the strategy or update an existing strategy.

5. Explain the chosen strategy.

The Batch Processor Immediate Batch panel appears so that you can specify the job stream information. With the Immediate Batch mode, you do not have to close the batch data set and the Batch Processor is invoked automatically so that you can submit the job. For more information, see the chapter “Introduction.”

To use batch mode

1. Request batch mode by entering B in Mode on the Main Menu or by entering MODE B on the command line. Specify the Batch Processor data set. See the “Introduction” chapter for more information.

2. Request the Explain Strategy Services option from the Main Menu.

You can request the Quick Explain option, but no strategies or versions are created when you use this option.

3. Create the strategy or update an existing strategy.

4. Explain the chosen strategy.

5. Deallocate the data set by entering O in Mode on the Main Menu, by entering MODE O on the command line, or by exiting CA Plan Analyzer.

For more information, see the chapter “Introduction.”

6. Submit the Batch Processor data set.

For example, enter BP in the CA Plan Analyzer command line to access the Batch Processor. When you use the Batch Processor to process the data set's input, it can execute the data set online or it can write JCL to a specified data set.

Note: For more information, see the Batch Processor Reference Guide.

186 User Guide

Page 187: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Creating Strategies and Versions in Batch

When a strategy or version does not exist, it is created for you automatically. This lets you optionally bypass the online portion of CA Plan Analyzer. The following illustration shows the sample enhanced explain input that creates a strategy or version. This example assumes that the strategy and version does not already exist.

EDIT ---- USER1.TEST.PDS(SAMP1) - ---------------------- COLUMNS 001 072 COMMAND ===> SCROLL ===> CSR 003900 .CALL EXPLAIN 004000 .DATA 004100 RULESSID = (PTI2) 004200 DESCR = (SAMPLE STRATEGY) 004300 STRATEGY = (T23A,CATALOG,USERxx,VER1) 004400 ACM = (N) 004600 PLANTAB = (ROLLBACK) 004700 FORMAT = (SHORT) 004800 TARGET = (PTI2,(QARULES)) 004900 REPORT = (SUMMARY,COST,ACCESS,SQLRULES) 005000 SRCDBRML = (PPA.WRK0102.DBRMLIB(PPA#TVAS),) 005100 .ENDDATA

The following describes the DESCR and STRATEGY cards shown in the preceding explain processing batch input:

DESCR

You can add the description card to indicate the description of the version. The description is also used as the strategy description for a new strategy. When you include DESCR in the input, enter it before the STRATEGY card.

STRATEGY

When the strategy exists, but the version does not, the strategy card indicates the version name. For example, you submit this job using version VER1. The second time you submit this job, you change VER1 to VER2 to create a new version of the same strategy.

When the strategy and version exist, but the CA Plan Analyzer explain was not completed successfully, the strategy card indicates that version information must be deleted and that the current explain information must be saved to that version.

When the strategy and version exist and the explain completes successfully, you cannot execute another explain using the same strategy card information for the version. An error is issued if you try to re-run a completed version. For example, when you submit this job as version VER1, an error message is issued if you try to submit this job again as version VER1.

Chapter 10: Using Batch Reporting 187

Page 188: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

You do not need the strategy card included in your batch job JCL. However, to save the enhanced explain results, you must use this card.

If this does not exist, the strategy card indicates the subsystem the strategy must be created on (T23A), the strategy name (CATALOG), the strategy creator (USERxx), and the strategy version (VER1).

■ Saving results-To create a strategy or version, include the appropriate information within the strategy card. Enhanced explain processing automatically creates and saves the strategy, version, or both during job submission. This is useful to review the results again at some future time, or to later use any of the other enhanced CA Plan Analyzer explain features, such as Query Explain Database.

■ Not saving results-When you exclude the strategy card, the enhanced explain process automatically creates a temporary strategy and version during job submission. The enhanced explain results are not saved. This is useful when you do not have to review the results at any future time.

Note: For more information, see the CA Plan Analyzer Reference Guide.

Enhanced Explain Return Codes

The enhanced explain return code passed to the Batch Processor is the highest code of the following three:

■ The highest severity codes set through the Expert System Rules reports.

■ The highest enhanced explain exceptions return code.

■ The highest Compare Explain Versions report return code.

The enhanced explain exceptions return code and the Compare Explain Versions report return codes are described in the following section.

Return Codes for Enhanced Explain Exceptions

You can specify the return codes for three different types of enhanced explain exceptions. You define these user-defined return codes in the PARMLIB at installation. You can set the value to any number from 0 to 4095. The default setting in the PARMLIB is 0.

188 User Guide

Page 189: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

These return codes give you immediate feedback on your explain processing. The enhanced explain exception return codes are described following:

EXPLRC1

There are no SQL statements for enhanced explain to process.

EXPLRC2

For future explain, SQL errors occurred during the explain or a special SQL code (@007) has been returned.

For current explain, a special SQL code (@001 - @006) has been returned.

For either a current or future explain, an SQL error occurred at connection time while executing a SET CURRENT SQLID = 'secondary authorization ID' command.

EXPLRC3

General errors occurred during enhanced explain processing.

Return Codes for Compare Explain Versions Report

You can specify three return codes for Compare Explain Versions reports. You define these return codes in the PARMLIB at installation. You can set the value to any number from 0 to 4095. The default setting in the PARMLIB is 0.

These return codes give you immediate feedback on your version comparisons. The Compare Explain Versions report return codes are described as follows:

CEVRC1

Access path differences were detected in the versions being compared.

CEVRC2

SQL or host variable differences were detected in the versions being compared.

CEVRC3

SQL cost differences were detected in the versions being compared.

Chapter 10: Using Batch Reporting 189

Page 190: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Highest Return Code Issued

CA Plan Analyzer considers three return codes before issuing return code for an SQL statement. The three return codes are:

■ The highest Expert System Rules report severity code.

■ The highest enhanced explain exception return code.

■ The highest Compare Explain Versions report return code.

After reviewing all three of these codes, CA Plan Analyzer returns the highest return code. Be sure to keep this in mind when setting your return and severity codes.

These return codes also set the Batch Processor return code that is returned to the job step. You then have the option to execute another job step conditionally.

190 User Guide

Page 191: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Sample 1 - After Precompilation

This section illustrates how you might implement enhanced explain processing in a development cycle. The following sample shows the JCL needed to precompile, explain, assemble, and link edit a source member. Notice that enhanced explain processing is invoked after the precompilation step. However, the program is compiled or linked when the DBRM created by the precompile step violates the rules that are applied by the enhanced explain step.

EDIT ---- USER1.TEST.PDS(SAMP1) - ---------------------- COLUMNS 001 072 COMMAND ===> SCROLL ===> CSR ****** ***************************** TOP OF DATA ****************************** 000100 //xxxxxx JOB (0625,PPA),'ASM-EXPL-LINK',CLASS=A, 000200 // MSGCLASS=X,REGION=4096K 000300 //* 000400 //******************************************************************** 000500 //*** PRE-COMPILE STEP *** 000600 //******************************************************************** 000700 //PC EXEC PGM=DSNHPC,PARM='HOST(ASM) LEVEL(0100)' 000800 //STEPLIB DD DSN=DSN.V220.DSNLOAD,DISP=SHR 000900 //SYSCIN DD DSN=&&DSNHOUT,DISP=(MOD,PASS),UNIT=SYSDA, 001000 // SPACE=(800,(500,500)) 001100 //SYSLIB DD DSN=PPA.WRK0102.MACLIB,DISP=SHR 001200 // DD DSN=PPA.RELxxxx.MACLIB,DISP=SHR 001300 //SYSPRINT DD SYSOUT=* 001400 //SYSTERM DD SYSOUT=* 001500 //SYSUT1 DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA 001600 //SYSIN DD DSN=PPA.WRK0102.ASM(PPA#TVAS),DISP=SHR 001700 //DBRMLIB DD DSN=PPA.WRK0102.DBRMLIB(PPA#TVAS),DISP=OLD 001800 //******************************************************************** 001900 //*** PLAN ANALYZER ENHANCED EXPLAIN *** 002000 //******************************************************************** 002100 //EXPLAIN EXEC PGM=PTLDRIVM,REGION=4M,PARM='EP=BPLBCTL' 002200 //STEPLIB DD DISP=SHR,DSN=PTIPROD.R920415.LOADLIB 002300 //PTILIB DD DISP=SHR,DSN=PTIPROD.R920415.LOADLIB 002400 //PTIPARM DD DISP=SHR,DSN=PTIPROD.R920415.PARMLIB 002600 //SYSOUT DD SYSOUT=* 002700 //UTPRINT DD SYSOUT=* 002800 //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 002900 //SYSREC DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 003000 //SORTOUT DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 003100 //BPIOPT DD * 003200 .CONTROL BPID(QUICK.EXPLAIN-PPA#TVAS) LOGID(PTI2) UNIT(SYSDA) 003300 .LIST SYSOUT(*) 003400 .OPTION NOERRORS 003500 .RESTART OVERRIDE 003600 .CONNECT PTI2 003700 /*

Chapter 10: Using Batch Reporting 191

Page 192: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

The following describes part one of the precompile sample:

Source Member

The upper section shows the step for precompilation. In this example, the SYSIN is precompiled to produce a DBRM (PPA#TVAS) in library (PPA.WRK0102.DBRMLIB).

Enhanced Explain

This section shows the step to run the Batch Processor so that enhanced explain processing is invoked.

EDIT ---- USER1.TEST.PDS(SAMP1) - ---------------------- COLUMNS 001 072 COMMAND ===> SCROLL ===> CSR 003900 //BPIIPT DD * 004000 .CALL EXPLAIN 004100 .DATA 004200 RULESSID = (PTI2) 004300 ACM = (N) 004400 PLANTAB = (ROLLBACK) 004500 FORMAT = (SHORT) 004600 TARGET = (PTI2,(QARULES)) 004700 REPORT = (SUMMARY,COST,ACCESS,SQLRULES) 004800 SRCDBRML = (PPA.WRK0102.DBRMLIB(PPA#TVAS),) 004900 .ENDDATA 005000 /* 005100 //******************************************************************** 005200 //*** ASSEMBLE STEP *** 005300 //******************************************************************** 005400 //ASM EXEC PGM=IEV90,PARM='OBJECT,NODECK',COND=(4,LT) 005500 //SYSLIB DD DSN=PPA.WRK0102.MACLIB,DISP=SHR 005600 // DD DSN=PPA.RELxxxx.MACLIB,DISP=SHR 005700 // DD DSN=SYS1.MACLIB,DISP=SHR 005800 // DD DSN=DSN.V230.DSNMACS,DISP=SHR 005900 //SYSPRINT DD SYSOUT=* 006000 //SYSTERM DD SYSOUT=* 006100 //SYSUT1 DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(CYL,(2,5)) 006200 //SYSLIN DD DSN=PPA.WRK0102.OBJLIB(PPA#TVAS),DISP=OLD 006300 //SYSIN DD DSN=&&DSNHOUT,DISP=(OLD,DELETE) 006400 //******************************************************************** 006500 //*** LINK STEP *** 006600 //******************************************************************** 006700 //LKED EXEC PGM=IEWL,PARM=(XREF,LET,LIST),REGION=1M,COND=(4,LT) 006800 //SYSLIB DD DSN=PPA.WRK0102.OBJLIB,DISP=SHR 006900 // DD DSN=PPA.RELxxxx.OBJLIB,DISP=SHR 007000 //ISPF DD DSN=ISP.V3R2M0.ISPLOAD,DISP=SHR 007100 //SYSLMOD DD DSN=PPA.WRK0102.LOADLIB,DISP=SHR 007200 //SYSUT1 DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(1024,(150,120)) 007300 //SYSPRINT DD SYSOUT=* 007400 //SYSLIN DD DSN=PPA.WRK0102.LMOD(PPL@TARG),DISP=SHR ****** **************************** BOTTOM OF DATA **************************

192 User Guide

Page 193: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

The following describes part two of the precompile sample:

Enhanced Explain Input

This section lists the input used to perform the enhanced explain against the DBRM. This section contains the same information that is generated when batch mode is used to explain a strategy. You can modify the input within this section to add or subtract information. Two cards within this section require additional attention: TARGET and SRCDBRML.

■ TARGET-The ruleset specified in this example, QARULES, has a small subset of rules that cannot be violated. The severity codes of the rules are set to 8 through Update Expert System Rules.

■ In this example, a return code of 08 is issued whenever any of the rules within rule set PTI2.QARULES are violated. For more information, see the chapter “Updating Expert System Rules.”

■ SRCDBRML-Source DBRM library. This shows the DBRM created during the precompilation (first step).

Conditional Parameters

In the assemble and link steps, a conditional parameter (COND=) is entered. The conditional parameter prevents the assemble and link steps from occurring when the return codes from the prior two steps (precompile and enhanced explain) are greater than 4.

Note: For more information, see the IBM JCL User's Guide.

Chapter 10: Using Batch Reporting 193

Page 194: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Implementing Plan Analyzer in the Development Cycle

Sample 2 - Moving a Plan from Test to Production

The following sample JCL determines how a plan from the test subsystem (TEST) performs on the production subsystem (PROD). An enhanced explain is executed. If any of the rules in the user-defined rule set (QARULES) are violated, the plan is not bound on the production subsystem.

****** ***************************** TOP OF DATA ****************************** 000100 //USER1AX JOB (0625,PPA),'PPA EXPLAIN-BIND',CLASS=A, 000200 // MSGCLASS=X,REGION=4096K 000300 //* 000400 //******************************************************************** 000500 //*** PLAN ANALYZER ENHANCED EXPLAIN *** 000600 //******************************************************************** 000700 //EXPLAIN EXEC PGM=PTLDRIVM,REGION=4M,PARM='EP=BPLBCTL' 000800 //STEPLIB DD DISP=SHR,DSN=PTIPROD.R920415.LOADLIB 000900 //PTILIB DD DISP=SHR,DSN=PTIPROD.R920415.LOADLIB 001000 //PTIPARM DD DISP=SHR,DSN=PTIPROD.R920415.PARMLIB 001200 //SYSOUT DD SYSOUT=* 001300 //UTPRINT DD SYSOUT=* 001400 //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 001500 //SYSREC DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 001600 //SORTOUT DD UNIT=SYSDA,SPACE=(TRK,(1,1)) 001700 //BPIOPT DD * 001800 .CONTROL BPID(STRATEGY.EXPLAIN-PPAM0102) LOGID(PTI2) UNIT(SYSDA) 001900 .LIST SYSOUT(*) 002000 .OPTION NOERRORS 002100 .RESTART OVERRIDE 002200 .CONNECT PTI2 002300 /* 002400 //BPIIPT DD * 002500 .CALL EXPLAIN 002600 .DATA 002700 RULESSID = (PROD) 002800 ACM = (N) 003000 PLANTAB = (ROLLBACK) 003100 FORMAT = (SHORT) 003200 TARGET = (PROD,(QARULES)) 003300 REPORT = (SUMMARY,COST,ACCESS,SQLRULES) 003400 SRCCAT = (TEST,LOCAL,PPAM0102,,) 003500 .ENDDATA 003600 /* 003700 //******************************************************************** 003800 //*** BIND STEP *** 003900 //******************************************************************** 004000 //RCUTIL EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) 004100 //STEPLIB DD DSN=DSN.V220.DSNLOAD,DISP=SHR 004200 //DBRMLIB DD DSN=PPA.WRK0102.DBRMLIB,DISP=SHR 004300 // DD DSN=PPA.RELxxxx.DBRMLIB,DISP=SHR 004400 //SYSTSPRT DD SYSOUT=* 004500 //SYSPRINT DD SYSOUT=* 004600 //SYSUDUMP DD SYSOUT=* 004700 //SYSOUT DD SYSOUT=* 004800 //REPORT DD SYSOUT=* 004900 //SYSTSIN DD DSN=PPA.WRK0102.PLAN.PROD(PPAM0102),DISP=SHR ****** *************************** BOTTOM OF DATA ***************************

194 User Guide

Page 195: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

The following describes the production sample:

TARGET

Indicates the target subsystem and rule set that must be used during enhanced explain processing. Here, PROD is the target production subsystem and QARULES is the rule set defined by the user.

SRCCAT

The source information for a Catalog (C) type is entered in the SRCCAT card. The source subsystem (TEST) is used. Here, TEST is the user's test subsystem. Plan PPAM0102 and all its DBRMs and packages are explained.

Batch Input SQL statements, DDL statements, and Batch Processor commands collectively are called Batch Processor (batch) input. CA Plan Analyzer generates batch input for its Create User PLAN_TABLEs, Plan/Package Utilities, Enhanced Explain, and Statistics Manager features. The batch input is combined with a job stream so that the batch input with the job stream can be executed online, in batch, or in immediate batch.

CA Plan Analyzer optionally displays the batch input on the Batch Processor Card Display panel. The CA Plan Analyzer (PPA) Profile default determines whether this panel is displayed. When this panel is displayed, the batch input is executed only after you confirm that it can be executed. When this panel is not displayed, CA Plan Analyzer assumes confirmation and begins execution automatically.

This section describes the Mode field, Batch Processor Card Display panel, online mode, batch mode, immediate batch mode, and the Batch Processor.

Mode Field

You can execute the batch input in online, batch, or immediate batch mode. The header's Mode field determines how the batch input is executed by the Batch Processor:

■ O-Execution is performed online.

■ B-Execution is performed in batch.

■ I-The Batch Processor is invoked immediately so you can submit the job.

Note: Mode does not control how CA Plan Analyzer reports are generated. CA Plan Analyzer reports are generated online, unless you request batch reporting by entering the BATCH command.

Chapter 10: Using Batch Reporting 195

Page 196: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Batch Processor Card Display Panel

Batch input is generated after you indicate that you want your request processed from the CA Plan Analyzer feature. For example, if you entered REBIND on the command line from a plan listing, the batch input is generated when you press Enter. Batch input is displayed, depending on your CA Plan Analyzer Profile value.

Note: This discussion assumes that the CA Plan Analyzer Profile value for the Batch Processor Card Display Default is set to Y, which specifies that the Batch Processor Card Display panel appears before batch processing. When this default is set to N, batch input is processed without confirmation.

196 User Guide

Page 197: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

All batch input executed to perform your request is displayed on the Batch Processor Card Display panel. The Batch Processor Card Display panel appears whether you use online or batch mode. Use your PF7 or PF8 keys to scroll up and down through the batch input. The following displays the input for multiple REBINDs:

P ------- PPA Batch Processor Card Display ------- COMMAND ===> SCROLL ===> CSR Mode ===> O ONLINE The following Batch Processor input has been generated. Press ENTER to process, press END to cancel, or enter the EDIT command to edit. ---------------------------------------------------------------------- xxxxxx ********************************* TOP OF DATA ********************************* .CALL DSN PARM(D81A) .DATA REBIND PLAN ( @QUALTST ) - OWNER ( PDEDM ) - QUALIFIER ( PDEDMA ) - CACHESIZE ( 1024 ) - VALIDATE ( RUN ) - ISOLATION ( CS ) ACQUIRE ( USE ) - RELEASE ( COMMIT ) EXPLAIN ( NO ) - - NODEFER ( PREPARE ) CURRENTDATA ( NO ) - DEGREE ( 1 ) SQLRULES ( DB2 ) - REBIND PLAN ( V81TEST ) - OWNER ( TSPROD ) - QUALIFIER ( TSPROD ) - CACHESIZE ( 1024 ) - VALIDATE ( RUN ) - ISOLATION ( CS ) ACQUIRE ( USE ) - RELEASE ( COMMIT ) EXPLAIN ( NO ) - - NODEFER ( PREPARE ) CURRENTDATA ( NO ) - DEGREE ( ANY ) SQLRULES ( DB2 ) - REBIND PLAN ( V22$KRL ) - OWNER ( TSPROD ) - QUALIFIER ( TSPROD ) - CACHESIZE ( 1024 ) - - VALIDATE ( RUN ) - ISOLATION ( CS ) ACQUIRE ( USE ) - DEGREE ( ANY )

The following describes the information displayed on the Batch Processor Card Display:

Mode

In the example, Mode is set to online.

Chapter 10: Using Batch Reporting 197

Page 198: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Batch Input

This section displays the actual input used to perform your request. In the example, the batch input to REBIND the plans displays collectively.

From the Batch Processor Card Display panel, you can:

■ Accept the input-Press Enter to have CA Plan Analyzer process the batch input. When you are in online mode, CA Plan Analyzer performs the batch input execution immediately. See the Online Mode (O) section for more information.

■ When you are in batch mode, the batch input is written to the Batch Processor data set specified when you entered batch mode. For more information, see Batch Mode (B).

■ Reject the input-Reject the processing by pressing PF3 (End) or by entering CANCEL on the command line.

■ Edit the input-Enter EDIT on the command line to edit the batch input with the SQL Editor.

Note: Any changes you make to the batch input appear on the Batch Processor Card Display panel. However, the changes to the batch input are not reflected on the appropriate selection list. For example, when you change a plan's VALIDATE value from RUN to BIND, the report continues to show the previous value of RUN.

Online Mode (O)

When you use online mode, CA Plan Analyzer displays the batch input it uses for execution on the Batch Processor Card Display panel. (This section assumes that the CA Plan Analyzer Profile default requests the display of the Batch Processor Card Display panel.) At this panel, accept the batch input by pressing Enter.

198 User Guide

Page 199: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

CA Plan Analyzer displays a wait panel and then immediately displays the execution of the batch input on the Audit Message File panel. The AUDIT Message File panel is shown in the following illustration.

BPPA.AUDT ----------- AUDIT Message File ----------- COMMAND ===> SCROLL ===> CSR ---------------------------------------------------------- User ID: xxxxxx .LIST TERM RETCODE = 0 .CONNECT T23A RETCODE = 0 .OPTION NOERRORS RETCODE = 0 .CALL DSN PARM(D31A) .ALLOC UNIT(SYSDA) FI(SYSTSIN) NEW SPACE(1,1) TRACKS + RECFM(F,B) LRECL(80) BLKSIZE(6320) .ALLOC UNIT(SYSDA) FI(SYSTSPRT) NEW SPACE(1,8) TRACKS + RECFM(VBA) LRECL(75) BLKSIZE(6324) .DATA REBIND PLAN ( @QUALTST ) - OWNER ( PDEDM ) - QUALIFIER ( xxxxxx ) - CACHESIZE ( 1024 ) - VALIDATE ( RUN ) - ISOLATION ( CS ) ACQUIRE ( USE ) - RELEASE ( COMMIT ) EXPLAIN ( NO ) - DEGREE ( ANY )

Each executed command displays with the resulting return code. If one statement fails, all changes are rolled back. You can page through the execution messages using your PF7 (Up) and PF8 (Down) scrolling keys. Press PF3 (End) to exit the display and return to the CA Plan Analyzer feature.

Note: For more information, see the Batch Processor Reference Guide.

Batch Mode (B)

When you use online mode, the batch input is processed immediately. When you use batch mode, the batch input is written to a batch data set.

Chapter 10: Using Batch Reporting 199

Page 200: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Requesting Batch Mode

You can request batch mode at any time by entering B in the header's Mode field. When you request batch mode, the Batch Specification panel appears.

PPBM --------------- Batch Specification -------------- COMMAND ===> Enter Specifications for your Batch Data Set. ISPF LIBRARY: PROJECT ===> xxxxxx GROUP ===> DB2 TYPE ===> CNTL MEMBER ===> BTEST (Blank or pattern for member selection list) OTHER PARTITIONED OR SEQUENTIAL DATA SET: DATA SET NAME ===> VOLUME SERIAL ===> (If not cataloged) DATA SET OPTIONS: IF PARTITIONED, REPLACE EXISTING MEMBERS ===> YES (YES or NO) ENTER DATA SET DISPOSITION ===> SHR (OLD or SHR) IF SEQUENTIAL, ENTER DATA SET DISPOSITION ===> SHR (OLD,SHR, or MOD)

ISPF Library

The following fields let you enter a partitioned data set name:

PROJECT, GROUP, TYPE, MEMBER

In the PROJECT, GROUP, TYPE, and MEMBER fields, enter the name of the partitioned data set that must be the batch data set. In MEMBER, you can enter standard ISPF member selection criteria (for example, MEMB*) to list members meeting the criteria.

Member Selection

When a member is not specified for a PDS, a member selection list appears when you press Enter. From the member selection list, you can select, edit, or browse a member.

200 User Guide

Page 201: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Other Partitioned or Sequential Data Set

The following fields let you enter a partitioned or sequential data set name:

DATA SET NAME

Enter the name of the partitioned data set that must be the batch data set. You can request a member selection list by entering standard ISPF member selection criteria, for example, (MEMB*) to list members meeting the criteria.

VOLUME SERIAL

If the data set is not cataloged, enter a volume serial number.

Data Set Options

The following fields let you specify the data set options. Enter information in these fields when the batch data set is a partitioned data set or sequential data set.

IF PARTITIONED

For a partitioned data set, specify the replacement and disposition requirements:

■ REPLACE-Enter YES to replace the member when it already exists. If you entered selection criteria for MEMBER, you must enter YES to replace the member. Otherwise, the member selection list does not appear.

Enter NO if you do not want the member replaced when it already exists.

■ DISPOSITION-Enter OLD to allocate the data set and prevent other users or jobs from accessing the data set while you have it allocated. In this case, the whole PDS is locked out.

Enter SHR to allocate the data set but permit other users or jobs to access the data set (PDS).

IF SEQUENTIAL

For a sequential data set, specify the disposition requirements:

■ Enter OLD to allocate the data set and prevent access from other users and jobs. The previous contents of the data set are overwritten.

■ Enter SHR to allocate the data set and permit other users and jobs to access the data set. The previous contents of the data set are overwritten.

■ Enter MOD to add the generated DDL to the end of the data set.

Chapter 10: Using Batch Reporting 201

Page 202: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

You can cancel from the Batch Processor Specification panel by pressing PF3 (End) or you can enter the Batch Processor data set information and press Enter.

When you press Enter, the specified Batch Processor is allocated and opened. You return to the previous panel, and a message informs you that the data set has been allocated.

Viewing Batch Input

When you use batch mode, CA Plan Analyzer displays the batch input it uses for execution on the Batch Processor Card Display panel (assuming that the CA Plan Analyzer Profile default specifies the display of the Batch Processor Card Display panel). At this panel, accept the batch input by pressing Enter. The batch input is written to the Batch Processor data set specified at the time you requested batch mode.

Ending Batch Mode

Do one of the following to end batch processing:

■ Exit CA Plan Analyzer. CA Plan Analyzer closes and deallocates the data set automatically.

■ Switch the Mode from B (Batch) to O (Online). See the Changing Modes section for more information.

Executing the Batch Generated Data Set

To execute a data set generated by the batch mode, use the CA Plan Analyzer Batch Processor (BP) command. The BP command initiates the Batch Processor to execute the batch input in a data set. In this case, the data set is the one data set generated by batch mode.

You have the following options for execution:

■ You can execute the batch input online or in batch (JES).

■ You can write the Batch Processor job to a data set. You can then submit the job at any time. This data set contains all the necessary JCL to invoke the Batch Processor to execute the specified data set.

Note: For more information, see the Batch Processor Reference Guide.

202 User Guide

Page 203: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Immediate Batch Mode (I)

With Batch mode, the Batch Processor input is written to the Batch Processor data set. To submit the job, you must change your mode to close the Batch Processor data set and invoke the Batch Processor. With the Immediate Batch mode, you do not have to close the batch data set; the Batch Processor is invoked automatically so you can submit the job.

Requesting Immediate Batch Mode

You can request immediate batch mode at any time by entering I in the header's Mode field. When you request an Enhanced Explain in immediate batch mode, the Immediate Batch panel appears.

PPBPIB ------ PPA Batch Processor Immediate Batch ----- COMMAND ===> SCROLL ===> CSR Option ===> (S - Submit, E - Edit, D - Write to Dataset) Action ===> ( B - Bind, R - Rebind, F - Free --- Plans/Pkgs) ----------------------------------------------------------------- xxxxxx JOBCARD ===> //USERxx JOB (TD20-230-TSO),'TEST',CLASS=C,MSGCLASS=X, ===> // MSGLEVEL=(1,1),REGION=4096K,NOTIFY=USERxx ===> ===> SYSOUT ===> * (JES SYSOUT class to be used) *************************** BATCH PROCESSOR INPUT *************************** .CALL EXPLAIN .DATA PRODUCT = (SQE) RULESSID = (D23A) ACM = (N,USERxx) PLANTAB = (ROLLBACK) PRIAUTH = (xxxxxx) SECAUTH = (xxxxxx) SQLQUAL = (xxxxxx)

The following describes the fields that require information to specify the job stream information about the Batch Processor Immediate Batch panel:

Option

Specify the options for processing the Batch Processor input.

■ S-Submit the Batch Processor input.

■ E-Edit the Batch Processor input.

■ D-Write the Batch Processor input to a data set.

Chapter 10: Using Batch Reporting 203

Page 204: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Action

(Optional) Indicate the action you want taken on the list of plans or packages in the report you requested.

■ B-Bind the list of plans or packages generated by the report.

■ R-Rebind the list of plans or packages generated by the report.

■ F-Free the list of plans or packages generated by the report.

■ (blank)-Leave this field blank if you do not want to bind, rebind, or free the list of plans or packages generated by the report.

JOBCARD

Specify the JOB statement to perform your request. You can specify up to four lines. At least one line, a valid JOB statement, is required.

SYSOUT

Specify the output class for the job. In the example, an asterisk (*) indicates that the JOB statement's MSGCLASS output class must be used as the default.

BATCH PROCESSOR INPUT

Displays the Batch Processor input used to process your request. In the example, a bind of all the selected plans is performed. You can press PF7 (Up) and PF8 (Down) to scroll within the Batch Processor input section.

You can cancel from the Batch Processor Immediate Batch panel by pressing PF3 (End).

You can also press Enter after you have specified the appropriate information. Processing proceeds according to the value specified in Option:

■ Submit (S)-The Batch Processor input is immediately submitted to JES.

■ Edit (E)-An edit session is displayed with the Batch Processor input used for execution. The editor that displays is the editor you selected in your CA Plan Analyzer profile. You can modify the Batch Processor input. Press PF3 (End) to return to the Batch Processor Immediate Batch panel. The entire job stream appears.

■ Write to dataset (D)-The Batch Reporting Dataset Selection panel appears. You can enter the necessary information to have your Batch Processor input written to a data set. The next section details this option.

204 User Guide

Page 205: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Writing the Batch Input to a Data Set

When you specify writing your Batch Processor input to a data set (Option = D), the Batch Processor Dataset Selection panel appears.

PPBPIB --------- PPA Batch Dataset Selection ---------- COMMAND ===> Enter Specifications for your Batch Job File. ISPF LIBRARY: PROJECT ===> xxxxxx GROUP ===> WORK TYPE ===> CNTL MEMBER ===> IMBATCH (Blank or pattern for member selection list) OTHER PARTITIONED OR SEQUENTIAL DATA SET: DATA SET NAME ===> VOLUME SERIAL ===> (If not cataloged) DATA SET OPTIONS: IF PARTITIONED, REPLACE EXISTING MEMBERS ===> NO (YES or NO) ENTER DATA SET DISPOSITION ===> SHR (OLD or SHR) IF SEQUENTIAL, ENTER DATA SET DISPOSITION ===> SHR (OLD,SHR, or MOD)

ISPF Library

The following fields let you enter a partitioned data set name:

PROJECT, GROUP, TYPE, MEMBER

In the PROJECT, GROUP, TYPE, and MEMBER fields, enter the name of the partitioned data set that must be the batch data set. In MEMBER, you can enter standard ISPF member selection criteria (for example, MEMB*) to list members meeting the criteria.

Member Selection

When you do not specify a member for a PDS, a member selection list appears when you press Enter. From the member selection list, you can select, edit, or browse a member.

Chapter 10: Using Batch Reporting 205

Page 206: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Other Partitioned or Sequential Data Set

The following fields let you enter a partitioned or sequential data set name:

DATA SET NAME

In DATA SET NAME, enter the name of the partitioned data set that must be the batch data set. You can request a member selection list by entering standard ISPF member selection criteria, for example, (MEMB*) to list members meeting the criteria.

VOLUME SERIAL

If the data set is not cataloged, enter a volume serial number.

Data Set Options

The following fields let you specify the data set options. Enter information in these fields when the batch data set is a partitioned data set or sequential data set.

IF PARTITIONED

For a partitioned data set, specify the replacement and disposition requirements:

■ REPLACE-Enter YES to replace the member when it already exists. If you entered selection criteria for MEMBER, you must enter YES to replace the member. Otherwise, the member selection list does not appear.

Enter NO if you do not want the member replaced when it already exists.

■ DISPOSITION-Enter OLD to allocate the data set and prevent other users or jobs from accessing the data set while you have it allocated. In this case, the whole PDS is locked out.

Enter SHR to allocate the data set but permit other users or jobs to access the data set (PDS).

IF SEQUENTIAL

For a sequential data set, specify the disposition requirements:

■ Enter OLD to allocate the data set and prevent access from other users and jobs. The previous contents of the data set are overwritten.

■ Enter SHR to allocate the data set and permit other users and jobs to access the data set. The previous contents of the data set are overwritten.

■ Enter MOD to add the generated DDL to the end of the data set.

206 User Guide

Page 207: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

You can exit the Batch Processor Dataset Selection panel by pressing PF3 (End). Otherwise, enter the Batch Processor data set information and press Enter.

When you press Enter, the specified Batch Processor data set is allocated and opened. You return to the previous panel, and a message informs you that the data set has been allocated.

Ending Immediate Batch Mode

Perform one of the following to end immediate batch mode:

■ Exit CA Plan Analyzer. CA Plan Analyzer closes and deallocates the data set automatically.

■ Switch Mode from I (Immediate Batch) to O (Online). For more information, see Changing Modes.

Changing Modes

You can change modes while you are using CA Plan Analyzer using the Mode field displayed on any CA Plan Analyzer panel.

Changing from Batch to Online Mode

When you switch from batch mode to online mode, the Online Specification panel appears so you can specify the disposition of the data set.

PPOM ------------- Online Specification --------------- COMMAND ===> OPTION ===> 1 1) Enter ONLINE Mode, and CLOSE and UNALLOCATE batch dataset. 2) Enter ONLINE Mode, leave batch dataset ALLOCATED and OPEN. 3) Enter ONLINE Mode, and CLOSE and UNALLOCATE batch dataset and call the Batch Processor. ------------------------------------------------------------------------------- CURRENT ALLOCATION STATUS: DDNAME : SYS00094 DATASET NAME : 'xxxxxx.WORK.CNTL(BATCH2)' DISPOSITION : SHR

Chapter 10: Using Batch Reporting 207

Page 208: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

The following describes the fields on the Online Specification panel:

OPTION

Specifies what to do with the currently opened data set.

■ 1-Close and deallocate the data set.

■ 2-Leave the data set open while you perform online work. Use this option to change to Online mode temporarily and then return to batch mode using the same data set.

■ 3-Close and unallocate the data set; then access the Batch Processor so you can submit any Batch Processor input you saved to your batch data set.

Current Allocation Status

Displays the data set name and specified disposition. The DDNAME displayed is the temporary DDNAME allocated by MVS.

Changing from Batch to Immediate Batch Mode

When you change from Batch to Immediate Batch mode, the Batch Specification panel appears so you can specify the disposition of the data set.

PPIM --------- Immediate Batch Specification ---------- COMMAND ===> OPTION ===> 1 1) Enter Immediate Batch Mode, and CLOSE and UNALLOCATE batch dataset. 2) Enter Immediate Batch Mode, leave batch dataset ALLOCATED and OPEN. ------------------------------------------------------------------------------- CURRENT ALLOCATION STATUS: DDNAME : SYS00096 DATASET NAME : 'xxxxxx.WORK.CNTL(BATCH3)' DISPOSITION : SHR

The following describes the fields on the Immediate Batch Specification panel:

OPTION

Specifies what to do with the currently opened data set.

■ 1-Close and unallocate the data set.

■ 2-Leave the data set open while you perform online work. Use this option to change to Immediate Batch mode temporarily and then return to batch mode using the same data set.

208 User Guide

Page 209: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Current Allocation Status

(Display only) Displays the data set name and specified disposition. The DDNAME displayed is the temporary DDNAME allocated by MVS.

Following are the effects of changing modes:

■ Change from Immediate to Batch Mode-The Batch Specification panel appears. For more information, see Batch Mode (B).

■ Change from Immediate to Online Mode-A message displays indicating the mode has been set to Online mode.

■ Change from Online or Immediate to Batch Mode-The Batch Specification panel appears. Enter the specifications you want defined for your batch data set. You must complete this information and press Enter to change to Batch mode.

Sample Scenario

Batch mode is useful when you are executing a lengthy enhanced explain request. When you execute in batch, the enhanced explain is performed in the background so you can continue working online without waiting for the Enhanced Explain to complete.

The following illustrations show how to request an enhanced explain in batch mode. For this scenario, we create a strategy, switch from online mode to batch mode, create a batch data set, switch back to online mode, and request submission to the Batch Processor.

Note: You can request Batch mode at any time. For illustration purposes, this scenario requests batch mode after the strategy version is specified.

Chapter 10: Using Batch Reporting 209

Page 210: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Creating the Strategy

You can use this procedure to create the strategy.

To create the strategy

1. Enter 2 on the command line to request Explain Strategy Services from the Main Menu.

Mode must be set to O. If it is not, enter O in this field to begin this scenario in online mode.

PPM ------------- Plan Analyzer Main Menu ------------- COMMAND ===> 2 ACM ===> OFF Mode ===> O ONLINE ---------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 EXPLAIN Services Reporting Services 1) Quick EXPLAIN 6) Plan Reporting 2) EXPLAIN Strategy Services 7) DBRM Reporting 3) Query EXPLAIN Database 8) Package Reporting 4) Compare EXPLAIN Versions 9) Object Reporting 5) Update Expert System Rules 10) Statement Reporting Plan/Package Management Miscellaneous Functions 11) Identify Problem Plan/Packages A) Administrative Functions 12) Identify Problem SQL P) Profile 13) Plan/Package Utilities S) Statistics Manager 14) Create User PLAN_TABLEs T) Tutorial BP) Batch Processor/Submit X) Exit Plan Analyzer

2. Press Enter.

The Explain Strategy Services panel appears.

210 User Guide

Page 211: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Create a strategy by entering the appropriate information in the first line, known as the create line.

PPESM --------- PPA Explain Strategy Services -------- COMMAND ===> SCROLL ===> PAGE Strategy ===> * Creator ===> USERxx Type ===> E ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 STRATEGY T D S +----- LAST UPDATE -----+ CMD /VERSION DESCRIPTION CREATOR P B O USER DATE TIME C SAMPLE__ PPASCEN1 SCENARIO________ xxxxxx E U <=== STRATEGY CREATION _ PLANS PLAN EXAMPLE xxxxxx E U xxxxxx YYYY-MM-DD 15.19 _ SCENARIO EXAMPLE SCENARIO STRATEGY xxxxxx E U xxxxxx YYYY-MM-DD 18.22 _ VERS1 EXAMPLE VERSION 1 xxxxxx C M U xxxxxx YYYY-MM-DD 10.55 _ VERS2 EXAMPLE VERSION 2 xxxxxx C M U xxxxxx YYYY-MM-DD 13.27 ******************************** BOTTOM OF DATA *******************************

3. Press Enter.

Because our Profile is set to Expert mode, the Explain Strategy Data Editor panel appears.

4. Enter the SQL source information.

In this example, we request an Autobuild of plan PPASCEN1 and all the DBRMs beginning with PPA@SCE.

PPESDE ------- PPA Explain Strategy Data Editor ------- COMMAND ===> SCROLL ===> PAGE Strategy : SAMPLE Type ===> E Profile ===> Creator : USERxx Share Option ===> U Version : Description ===> PPASCEN1 SCENARIO ----------------------------------------------------------------- xxxxxx ----TARGET--- O C TY SSID RULE SET P LOCATION SSID PLAN/COLLID DBRM/PKG STMT C A_ D51B ________ Y LOCAL___________ D51B PPASCEN1__________ PPA@SCE% _____ ******************************** BOTTOM OF DATA *******************************

Chapter 10: Using Batch Reporting 211

Page 212: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

5. Press Enter to register your specifications.

Because Y is entered in the OP field, the Source Options panel appears. In this example, Y was entered to request a listing of available reports.

PPESSO ---- PPA Explain Strategy - SOURCE OPTIONS ---- COMMAND ===> ---------------------------------------------------------------------- xxxxxx SOURCE OPTIONS: Database Options ===> N (To select Historical Database options) Reports ===> Y (To select reporting options) Catalog Statistics ===> N (To select catalog statistics) Search Conditions ===> N (To select search conditions) Access Path Filters ===> N (To select access path filters) Search Filters ===> N (To enter search filters) Parallelism Degree ===> (To enter I/O Parallelism Degree) Press Enter.

The Reports panel appears.

6. Select the reports you want generated.

In this example, a Summary, Access, and SQLRULE report is selected for the strategy.

PPPETRP -------- PPA Explain Reports -------- 2006/08/28 20:21 COMMAND ===> ------------------------------------------------------------------------------- xxxxxx Summary Reports: Stmt Level Reports: Group Level Reports: Summary ===> Y Access ===> L Planrule ===> N Cost ===> N Predicate ===> N RI ===> N Dependency ===> N Tree ===> N Sqlrule ===> L Statistics ===> N Physrule ===> N Compare ===> N Predrule ===> N Performance ===> N Report Formatting Options: Compare Options ===> N Cost Filtering ===> Perf Total/Avg ===> T Suppress Reports ===> Y (Ignore Stmt Level reports if rules not fired) Press ENTER to process Press END (PF3/15) to quit

7. Press Enter to register your selections.

The Source Options panel reappears.

212 User Guide

Page 213: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

8. Press PF3 (End) to exit and return to the Explain Strategy Data Editor panel.

PPESDE ------- PPA Explain Strategy Data Editor ------- COMMAND ===> SCROLL ===> PAGE Strategy : SAMPLE Type ===> E Profile ===> Creator : USERxx Share Option ===> U Version : Description ===> PPASCEN1 SCENARIO ----------------------------------------------------------------- xxxxxx ----TARGET--- O C TY SSID RULE SET P LOCATION SSID PLAN/COLLID DBRM/PKG STMT _ A_ DSN_ ________ _ LOCAL___________ DSN_ __________________ ________ _____ _ A D51B ________ Y LOCAL___________ D51B PPASCEN1__________ PPA@SCE% _____ ******************************** BOTTOM OF DATA *******************************

9. Press PF3 (End) to exit and save the created SQL source.

The Explain Strategy Services panel reappears.

Requesting an Enhanced Explain - Batch Mode

To request an enhanced explain in batch mode

1. Enter E next to the created and saved strategy, SAMPLE.

The E option requests an Enhanced Explain of the strategy.

PPESM --------- PPA Explain Strategy Services -------- COMMAND ===> SCROLL ===> PAGE PP091I: Strategy SAMPLE saved. Strategy ===> * Creator ===> USERxx Type ===> E ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 STRATEGY T D S +----- LAST UPDATE -----+ CMD /VERSION DESCRIPTION CREATOR P B O USER DATE TIME _ ________ _________________________ xxxxxx E U <=== STRATEGY CREATION _ PLANS PLAN EXAMPLE xxxxxx E U xxxxxx YYYY-MM-DD 15.19 E SAMPLE PPASCEN1 SCENARIO xxxxxx E U xxxxxx YYYY-MM-DD 09.52 _ SCENARIO EXAMPLE SCENARIO STRATEGY xxxxxx E U xxxxxx YYYY-MM-DD 18.22 _ VERS1 EXAMPLE VERSION 1 xxxxxx C M U xxxxxx YYYY-MM-DD 10.55 _ VERS2 EXAMPLE VERSION 2 xxxxxx C M U xxxxxx YYYY-MM-DD 13.27 ******************************** BOTTOM OF DATA *******************************

2. Press Enter.

The Version Info panel appears.

Chapter 10: Using Batch Reporting 213

Page 214: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

3. Specify the version.

PPESES ------ PPA Explain Strategy - Version Info ----- COMMAND ===> Strategy : SAMPLE Type : E Profile ===> Creator : USERxx Share Option : U Version : Description : PPASCEN1 SCENARIO ---------------------------------------------------------------------- xxxxxx Version Information: Identifier ===> VER1 (Leave blank for system generated ID) Description ===> VERSION 1 Options: Replace existing version ===> N (Y,N) Update Explain Options ===> Y (Y,N)

4. Press Enter.

The Explain Options panel appears.

5. Press Enter.

The Batch Processor Card Display panel appears.

To switch to Batch mode, replace the O in Mode with B.

PPBPDI ------- PPA Batch Processor Card Display ------- COMMAND ===> SCROLL ===> PAGE Mode ===> B ONLINE The following Batch Processor input has been generated. Press ENTER to process, press END to cancel, or enter the EDIT command to edit. ----------------------------------------------------------------- xxxxxx ********************************* TOP OF DATA ********************************* .CALL EXPLAIN .DATA RULESSID = (DSN) ACM = (N,USERxx) VERSION = (LATEST) STRATEGY = (D51B,SAMPLE,USERxx,VER1) PLANTAB = (ROLLBACK) SQLQUAL = (USERxx) LINES = (55) PROCDDF = (Y) FLOATFMT = (SCI) PROCVIEW = (Y)

214 User Guide

Page 215: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

6. Press Enter.

The Batch Specification panel appears.

Batch mode writes the input to a batch data set.

The Batch Specification panel lets you specify the Batch Processor data set.

7. Enter this name in the ISPF Library or Other Partitioned Or Sequential Data Set fields.

In this example, the user specifies a partitioned data set: USERxx.WORK.CNTL(PPASCEN1).

PPBM -------------- Batch Specification --------------- COMMAND ===> Enter Specifications for your Batch Data Set. ISPF LIBRARY: PROJECT ===> USERxx GROUP ===> WORK TYPE ===> CNTL MEMBER ===> PPASCEN1 (Blank or pattern for member selection list) OTHER PARTITIONED OR SEQUENTIAL DATA SET: DATA SET NAME ===> VOLUME SERIAL ===> (If not cataloged) DATA SET OPTIONS: IF PARTITIONED, REPLACE EXISTING MEMBERS ===> YES (YES or NO) ENTER DATA SET DISPOSITION ===> SHR (OLD or SHR) IF SEQUENTIAL, ENTER DATA SET DISPOSITION ===> SHR (OLD,SHR, or MOD)

8. Press Enter.

The Batch Processor Card Display reappears.

Chapter 10: Using Batch Reporting 215

Page 216: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

CA Plan Analyzer indicates that the mode is set to batch.

PPBPDI ------- PPA Batch Processor Card Display ------- COMMAND ===> SCROLL ===> PAGE PP156I: Your current Mode is set to BATCH. Mode ===> B BATCH The following Batch Processor input has been generated. Press ENTER to process, press END to cancel, or enter the EDIT command to edit. ----------------------------------------------------------------- xxxxxx ********************************* TOP OF DATA ********************************* .CALL EXPLAIN .DATA RULESSID = (D51B) ACM = (N,xxxxxx) VERSION = (LATEST) STRATEGY = (D51B,SAMPLE,xxxxxx,VER1) PLANTAB = (ROLLBACK) SQLQUAL = (xxxxxx) LINES = (55) PROCDDF = (Y) FLOATFMT = (SCI) PROCVIEW = (Y)

9. Press Enter to accept the batch input displayed on the Batch Processor Card Display panel.

Closing the Batch Processor Data Set

The Explain Strategy Services panel reappears. CA Plan Analyzer indicates that the version was created. However, notice that I (for incomplete) appears in TP (Type). This indicates that the version has not been executed. To execute the Enhanced Explain for VER1, you must submit the Batch Processor data set. Switch back to online mode to close the Batch Processor data set.

PPESM --------- PPA Explain Strategy Services -------- COMMAND ===> MODE O SCROLL ===> PAGE PP097I: Strategy SAMPLE written to dataset and version VER1 created. Strategy ===> * Creator ===> USERxx Type ===> E ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 STRATEGY T D S +----- LAST UPDATE -----+ CMD /VERSION DESCRIPTION CREATOR P B O USER DATE TIME _ ________ _________________________ xxxxxx E U <=== STRATEGY CREATION _ PLANS PLAN EXAMPLE xxxxxx E U xxxxxx YYYY-MM-DD 15.19 _ SAMPLE PPASCEN1 SCENARIO xxxxxx E U xxxxxx YYYY-MM-DD 09.52 _ VER1 VERSION 1 xxxxxx I U xxxxxx YYYY-MM-DD 09.56 _ SCENARIO EXAMPLE SCENARIO STRATEGY xxxxxx E U xxxxxx YYYY-MM-DD 18.22 _ VERS1 EXAMPLE VERSION 1 xxxxxx C M U xxxxxx YYYY-MM-DD 10.55 _ VERS2 EXAMPLE VERSION 2 xxxxxx C M U xxxxxx YYYY-MM-DD 13.27 ******************************** BOTTOM OF DATA *******************************

216 User Guide

Page 217: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

To close a data set

1. Enter MODE O on the command line.

This is the primary command that lets you switch to online mode quickly.

2. Press Enter.

The Online Specification panel appears so you can specify the disposition of the Batch Processor data set.

3. Enter 1 to request online mode and to close and unallocate the data set.

PPOM -------------- Online Specification -------------- COMMAND ===> OPTION ===> 1 1) Enter ONLINE Mode, and CLOSE and UNALLOCATE batch dataset. 2) Enter ONLINE Mode, leave batch dataset ALLOCATED and OPEN. 3) Enter ONLINE Mode, and CLOSE and UNALLOCATE batch dataset and call the Batch Processor. ------------------------------------------------------------------------------- CURRENT ALLOCATION STATUS: DDNAME : SYS00116 DATASET NAME : 'xxxxxx.WORK.CNTL(PPASCEN1)' DISPOSITION : SHR

4. Press Enter.

CA Plan Analyzer writes the batch input to the Batch Processor data set specified on the Batch Specification panel. CA Plan Analyzer indicates that the mode is set to online.

Chapter 10: Using Batch Reporting 217

Page 218: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Submitting the Batch Processor Data Set

To submit a data set

1. Enter BP on the command line from any CA Plan Analyzer panel.

In this example, we entered BP from the Main Menu:

PPM ------------- Plan Analyzer Main Menu ------------- COMMAND ===> BP ACM ===> OFF Mode ===> O ONLINE ---------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 EXPLAIN Services Reporting Services 1) Quick EXPLAIN 6) Plan Reporting 2) EXPLAIN Strategy Services 7) DBRM Reporting 3) Query EXPLAIN Database 8) Package Reporting 4) Compare EXPLAIN Versions 9) Object Reporting 5) Update Expert System Rules 10) Statement Reporting Plan/Package Management Miscellaneous Functions 11) Identify Problem Plan/Packages A) Administrative Functions 12) Identify Problem SQL P) Profile 13) Plan/Package Utilities S) Statistics Manager 14) Create User PLAN_TABLEs T) Tutorial BP) Batch Processor/Submit X) Exit Plan Analyzer

2. Press Enter.

The Batch Processor Interface panel appears.

218 User Guide

Page 219: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Use this panel to invoke the Batch Processor. The Batch Processor is a tool that processes data sets that can contain SQL statements and Batch Processor commands.

PTBP -------- Batch Processor Interface --------- COMMAND ===> EXECUTION SPECIFICATIONS: EXECUTION MODE ===> B ( B - Batch mode, O - Online mode ) DB2 SSID ===> D51B BATCH PROCESSOR INPUT DATA SET: DATA SET NAME ===> 'xxxxxx.WORK.CNTL' MEMBER ===> PPASCEN1 ( Blank or pattern for member selection list ) VOLUME SERIAL ===> ( If not cataloged ) EDIT DATA SET ===> N ( Y - Yes, N - No ) PROCESSING OPTIONS: UNLOAD MODE ===> A CONTINUE IF: RESTART ===> N -WARNING ===> N TERM UTILITY ===> N -SQL ERROR ===> N RETRY LIMIT ===> 01 -BIND ERROR ===> N WRAP/TRUNCATE ===> W -LOAD DISCARDS ===> N AUDIT OPTIONS AUDIT TRAIL ===> Y OUTPUT CLASS ===> A OUTPUT FORM ===> OUTPUT DESTINATION ===>

3. Specify the information in each section.

Notice that you enter the specified Batch Processor data set in the Batch Processor Input Dataset section.

In this example, we entered B for batch execution of the batch input within the Batch Processor data set.

Press Enter.

The Batch JCL Specification panel appears.

Chapter 10: Using Batch Reporting 219

Page 220: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

The Batch JCL Specification panel defines parameters for batch execution. You must complete this panel if you selected the B (batch) execution option on the Batch Processor Interface panel.

PTBMOD -------- Batch JCL Specification -------- COMMAND ===> EXECUTION SPECIFICATIONS: DESTINATION ===> J ( J - JES, D - Dataset, P - Preview JCL ) OUTPUT JCL DATA SET SPECIFICATIONS: DATA SET NAME ===> 'xxxxxx.WORK.CNTL' MEMBER NAME ===> ( Blank or pattern for member selection list ) VOLUME SERIAL ===> ( If not cataloged ) REPLACE MEMBER ===> N ( Y - Yes, N - No ) MODEL JCL SPECIFICATIONS: MODEL LIBRARY ===> 'PTIPROD.RB708AB.MODEL' MODEL MEMBER ===> MJBPMDL ( Blank or pattern for member selection list ) VOLUME SERIAL ===> ( If not cataloged ) EDIT MODEL JCL ===> N ( Y - Yes, N - No ) UPDATE VALUES ===> N ( Y - Yes, N - No ) JOB statement SPECIFICATION: ==> //USERxx JOB (TD20-230-BAT),'TECH BAT',CLASS=A, ==> // MSGCLASS=X,MSGLEVEL=(1,1),REGION=4096K ==> //*JOBPARM ROOM=21 ==> //*

The Destination field indicates where to send the created JCL. You can send the JCL to JES or to a data set. You can also preview the JCL prior to sending it to JES or to a data set.

4. Enter J to submit the job to the internal reader (JES).

CA Plan Analyzer creates a JCL job and submits it to JES for batch execution.

5. Press Enter.

When the job is submitted, a message giving the job name and the JES job number appears. In this example, the following message appears:

PT576I: Job USERxxA(JOB18586) was submitted to JES. Press PF1 for help.

6. Press PF3 (End) to exit the Batch Processor panels.

7. Review the results of the submitted job.

220 User Guide

Page 221: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Batch Input

Chapter 10: Using Batch Reporting 221

In this example, the following illustrates the generated Summary report.

PPA Vxxx --------- Plan Analyzer Enhanced Explain ------------- Page 2 DATE YY/MM/DD Summary Report TIME HH:MM EXPLAIN PAGE PLAN/COLLECTION DBRM/PKG PACK VERS STMT NUM TYPE SQLCODE NUMBER ------------------ -------- -------------- ---------- ---- ------- ------ *TESTNEWV9 ........,V9NEWEXM, ............., 21,SEL , +0 3 *TESTNEWV9 ........,V9NEWEXM, ............., 34,SEL , +0 4 *TESTNEWV9 ........,V9NEWEXM, ............., 47,SEL , +0 5 *TESTNEWV9 ........,V9NEWEXM, ............., 67,SEL , +0 6 *TESTNEWV9 ........,V9NEWEXM, ............., 73,SEL , +0 7 *TESTNEWV9 ........,V9NEWEXM, ............., 79,SEL , +0 8 *TESTNEWV9 ........,V9NEWEXM, ............., 88,SEL , +0 9 *TESTNEWV9 ........,V9NEWEXM, ............., 109,MRG , +0 10 *TESTNEWV9 ........,V9NEWEXM, ............., 126,MRG , +0 11 *TESTNEWV9 ........,V9NEWEXM, ............., 140,SEL , +0 12 Target DB2 SSID: DBV9 The Most Severe SQLCODE: +0 Source DB2 SSID: DBV9 Total Number of Selects: 8 Collection: TESTNEWV9 Updates: 0 Package : V9NEWEXM Inserts: 0 Stmt : Deletes: 0 : Merges : 2

When you return to the Explain Strategy Services panel, TP (Type) for the version appears as C (for complete), rather than I (for incomplete). If TP still displays an incomplete status after you have submitted the Batch Processor data set, it probably means that the Enhanced Explain was not completed successfully.

PPESM --------- PPA Explain Strategy Services -------- COMMAND ===> SCROLL ===> PAGE Strategy ===> * Creator ===> TD% Type ===> E ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D51B Version ===> V5R1M0 STRATEGY T D S +----- LAST UPDATE -----+ CMD /VERSION DESCRIPTION CREATOR P B O USER DATE TIME _ ________ _________________________ xxxxxx E U <=== STRATEGY CREATION _ PLANS PLAN EXAMPLE xxxxxx E U xxxxxx YYYY-MM-DD 15.19 _ SAMPLE PPASCEN1 SCENARIO xxxxxx E U xxxxxx YYYY-MM-DD 09.52 _ VER1 VERSION 1 xxxxxx C U xxxxxx YYYY-MM-DD 10.10 _ SCENARIO EXAMPLE SCENARIO STRATEGY xxxxxx E U xxxxxx YYYY-MM-DD 18.22 _ VERS1 EXAMPLE VERSION 1 xxxxxx C M U xxxxxx YYYY-MM-DD 10.55 _ VERS2 EXAMPLE VERSION 2 xxxxxx C M U xxxxxx YYYY-MM-DD 13.27 ******************************** BOTTOM OF DATA *******************************

Page 222: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 223: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 11: Identifying Problem Plans and Packages

This section contains the following topics:

Understanding Problem Conditions (see page 223) Generating Reports (see page 228) Using Line Commands (see page 229)

Understanding Problem Conditions The Identify Problem Plans/Packages facility lets you search your plans and packages for nine different problem conditions. Using this feature, you can search for plans and packages that:

■ Use Repeatable Read for isolation level

■ Use Uncommitted Read for isolation level

■ Do not specify an isolation level (packages only)

■ Defer Validity Checking until run time

■ Are Invalid (require BIND/REBIND)

■ Are Inoperative (require explicit BIND/REBIND)

■ Are bound with EXPLAIN(NO)

■ Are bound with DEGREE(ONE)

■ Are bound with DEGREE(ANY)

For more information, see Understanding Problem Conditions.

When the problem plans and packages display on the Problem Plan and the Problem Package Lists, CA Plan Analyzer provides a wealth of information about them. For example, from either listing, you can:

Determine the BIND DATE/TIME

The listing shows when a plan or package was last bound. This helps when you receive SQL error code -818 indicating that your timestamps are not in sync. As a solution, you can check when the plan or package was last bound and REBIND it from the Problem Plan List or Problem Package List.

Chapter 11: Identifying Problem Plans and Packages 223

Page 224: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Problem Conditions

Access other CA Plan Analyzer reports

You can quickly gather more information about a specific plan or package by using any of the Plan Reporting or Package Reporting reports. You do not have to exit the listing to access the plan or package reports because all processing can be done directly from the listing.

Perform a BIND, REBIND, or FREE

Identify Problem Plans/Packages displays the plans and packages that can potentially cause performance problems. To correct the plans and packages, you can execute a BIND, REBIND, or FREE directly from the Problem Plan List or Problem Package List panel. A BIND or REBIND can correct an invalid or inoperative plan/package.

You can change a plan's or package's current VALIDATE and ISOLATION values when you select a BIND or REBIND. When CA Plan Analyzerexecutes these commands, it generates batch input. You can then edit the batch input to correct the VALIDATE and ISOLATION fields.

Repeatable Read (Plans or Packages)

CA Plan Analyzer displays the plan/package's current ISOLATION value on the Problem Plan/Package List panel. If the ISOLATION level is set to Repeatable Read (RR), any page locks are released at the next commit point. This can leave pages locked for long periods of time, demand the use of frequent commit points, and cause unacceptable overhead. For these reasons, organizations (especially those that use remote locations) must try to avoid using Repeatable Read (RR).

An alternative to Repeatable Read is Cursor Stability (CS). Cursor Stability locks a page when you access it and unlocks the page when you access a different page. Setting the ISOLATION level to CS grants maximum concurrency. However, when you re-access a page that has had its data changed by another application process, the program uses the changed data, rather than the data expected, to generate information.

Your site's needs must determine which ISOLATION level you must use per plan/package. However, we recommend avoiding the Repeatable Read level to prevent unnecessary overhead.

224 User Guide

Page 225: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Problem Conditions

Uncommitted Read

CA Plan Analyzer displays the plan/package's current ISOLATION value on the Problem Plan/Package List panel. If the ISOLATION level is set to Uncommitted Read (UR), the application acquires no page or row locks and can run concurrently with most other operations. The disadvantage is the application can read data that was changed by another operation but not yet committed. This can lead to data reliability issues, unless the user can accept the logical inconsistencies that can occur reading uncommitted data from another operation. For this reason, organizations must try to avoid using Uncommitted Read (UR).

A UR isolation level applies only to read-only SQL operations: SELECT, SELECT INTO, or FETCH from a read-only result table. If the result table is not read-only, then DB2 will default to Cursor Stability isolation.

An alternative to Uncommitted Read is Cursor Stability (CS). Cursor Stability locks a page when you access it and unlocks the page when you access a different page. Setting the ISOLATION level to CS grants maximum concurrency. However, when you re-access a page that has had its data changed by another application process, the program uses the changed data, rather than the data expected, to generate information.

Your site needs must determine which ISOLATION level you must use for your plans or packages. However, we recommend avoiding the Uncommitted Read level to prevent the possibility of reading uncommitted data where the importance of data in the application must be concise, accurate, and with no chance of errors.

No Isolation Level (Packages Only)

In addition to RR (Repeatable Read) and CS (Cursor Stability), the isolation level for a package can be blank. When the level is blank, the package inherits the isolation level of the plan that the package is included in. For example, suppose plan PLAN01 has an RR isolation level and package PACK01 has a blank isolation level. If PACK01 is included in the PKLIST (package list) of PLAN01 and PLAN01 is bound, PACK01 inherits the RR isolation level of PLAN01. As noted previously, an RR level might cause problems. Therefore, it is important to know which packages do not have a specified isolation level.

VALIDATE(RUN) (Plans or Packages)

Validity checking helps ensure that any references to objects (for example, tables, columns, and so on) are correct syntactically, the objects do exist, and EXECUTE authorization exists for the binder of the plan or package.

Chapter 11: Identifying Problem Plans and Packages 225

Page 226: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Problem Conditions

When you use VALIDATE(RUN), validity checking occurs at BIND time and again at run time for SQL that was not valid at BIND time. This can result in catalog contention and performance degradation. You must avoid VALIDATE(RUN) as much as possible. As an alternative, use VALIDATE(BIND). Full validity checking is performed at BIND time with this option. However, you might resort to VALIDATE(RUN) if the plan references an object that does not yet exist.

The VALIDATE value on the Problem Plan List or Problem Package List panel tells you whether the plan/package was bound with VALIDATE(BIND) or VALIDATE(RUN).

Invalid (Plans or Packages)

A plan or package is invalidated if access paths have changed or if objects on which the plan or package is dependent have been dropped. You can determine if the plan or package is invalid by the value in the VALID field on the Problem Plan List or Problem Package List panel.

Any invalid plan or package must be bound or rebound. DB2 automatically performs a BIND or REBIND on the plan or package when the invalid plan/package is executed. You can also have CA Plan Analyzer perform the BIND or REBIND directly from the Problem Plan List or Problem Package List panel.

Inoperative (Plans or Packages)

An inoperative plan or package cannot be allocated until an explicit BIND or REBIND is executed. A plan or package is marked inoperative if its automatic REBIND fails. You can determine whether a plan or package is inoperative by the value in the OPERATIVE field. NO in this field tells you that an explicit REBIND is necessary. You can perform a BIND or REBIND directly from the Problem Plan List or Problem Package List panel.

EXPLAIN(NO) (Plans or Packages)

When you request a BIND against a plan or package, you can specify a value for the EXPLAIN parameter. This parameter determines whether explain information must be generated (YES or NO).

226 User Guide

Page 227: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Understanding Problem Conditions

When you specify EXPLAIN(YES), the explain information tells you about SQL statement execution within the plan or package. The explain information is inserted into your PLAN_TABLE. The Database Administrator (DBA) can learn details about the indexes used for an SQL statement, the joins of tables, and the access paths for the SELECT parts of the SQL statement. When you specify EXPLAIN(YES), you incur minimal overhead processing. You achieve no great performance gains by specifying EXPLAIN(NO).

If you specify EXPLAIN(NO), no explain information populates the PLAN_TABLE. Most shops require that explain information is generated for a plan/package, especially prior to moving a plan/package from a test subsystem to a production subsystem.

CA Plan Analyzer lists the plans or packages that have been bound with EXPLAIN(NO). This is useful in quickly locating the plans or packages that need rebinding before turning the plans and packages over to your DBA. Listing plans or packages with EXPLAIN(NO) also helps when you are locating the plans or packages that do not have the CA Plan Analyzer enhanced explain reports generated when you request a Current type Explain. Current type Explains require that the plans or packages have been bound as EXPLAIN(YES). For more information, see the chapter “Understanding Current and Future Explains.”

Degree 1

CA Plan Analyzer displays the plan/package's current DEGREE of parallelism on the Problem Plan/Package List panel. If the DEGREE of parallelism is set to ONE, then execution of the application static SQL queries will be prohibited from using parallelism. The extra storage overhead required for parallelism will not be incurred by the application, but the disadvantage is the application may miss out on a dramatic increase in performance if the application could take advantage of parallel operations.

Your site's needs must determine whether setting DEGREE ONE must be applied per plan/package. Our recommendation is to examine the access path generated by bind explain (yes) as a guideline to determine whether the plan/package could not take advantage of parallelism.

Chapter 11: Identifying Problem Plans and Packages 227

Page 228: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Reports

Degree Any

CA Plan Analyzer displays the plan/package's current DEGREE of parallelism on the Problem Plan/Package List panel. If the DEGREE of parallelism is set to ANY, then execution of the application static SQL queries may use parallelism if the optimizer determines parallelism would increase the performance. The SQL query may take advantage of one or all parallelism types Query I/O parallelism, CPU parallelism, or SYSPLEX (data sharing members) parallelism. A scan of a large partitioned table spaces can have the greatest performance improvements where both query I/O and CPU operations can be carried out in parallel.

The disadvantage is the application may not use parallelism and will incur extra storage overhead associated with parallelism. Some instances where SQL queries do not qualify for parallelism are as follows: SQL queries that qualify for direct row access, EXISTS within a where predicate, or materialized views or materialized nested table expressions at reference time. A more detailed list of parallelism exceptions can be found in the DB2 administration guide.

The needs of your site must determine whether DEGREE ANY must be applied per plan/package. Our recommendation is to examine the access path generated by bind explain (yes) as a guideline to determine whether the plan/package could take advantage of parallelism.

Accessing This Feature

To access Identify Problem Plan/Packages enter 11 on the command line on the Main Menu, and press Enter. The Problem Plan/Packages Menu appears.

Generating Reports You can generate the Identify Problem Plan/Packages reports online or in batch. If you generate a report online, you can enter line commands to further analyze the data. See the Using Line Commands section for more information.

To generate a report online

1. Access the Problem Plan/Packages Menu. For more information, see Accessing This Feature.

2. Complete the appropriate fields:

■ For plans, complete the Name and Creator fields.

■ For packages, complete the Collid and Package fields.

3. To select one or more problems, enter S next to at least one problem in the list.

228 User Guide

Page 229: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

4. Press Enter.

The Problem Plan List or Problem Package List appears with the plans or packages meeting the criteria you specified.

5. Based on the action to perform, enter a subreport, utility, or special line command next to the appropriate plan or package.

6. Press Enter.

Based on the command you entered, the requested function executes or a panel representing that requested function appears.

To generate a report in batch

1. Access the Problem Plan/Packages Menu.

2. For more information, see Accessing This Feature.

3. Depending on the type of problem object to identify, complete the appropriate fields:

■ For plans, complete the Name and Creator fields.

■ For packages, complete the Collid and Package fields.

4. To select one or more problems, enter S next to at least one problem in the list.

5. Enter BATCH in the command line.

6. Press Enter.

The Batch Reporting Job Submission panel appears.

7. For Option, enter S.

8. Press Enter.

The Problem Plans/Packages Menu reappears with a message indicating that the job has been submitted to JES.

Using Line Commands You can use line commands to invoke CA Plan Analyzer utilities functions or reports from the Problem Plan List or the Problem Package List panels. The line command you choose must be appropriate for the object on which to use it on (plan commands for plans, package commands for packages).

Chapter 11: Identifying Problem Plans and Packages 229

Page 230: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

230 User Guide

List of Available Line Commands

The following list shows the line commands that are available from the Problem Plan List and Problem Package List panels. To determine which commands are valid for a particular line, see the online help. See the Accessing Online Help section for more information.

■ B-Bind

■ BO-Bind with Options

■ BR-Plan or Package Bind Parameters

■ D-Plan or Package Detail

■ DP-Plan or Package Dependency

■ DR-DBRM Detail

■ DTR-Drop Trigger

■ E-Plan or Package Explain

■ F-Free

■ L-Plan or Package List

■ PP-Plan Packlist

■ QE-Quick Explain

■ R-Rebind

■ RO-Rebind with Options

■ RR-Plan or Package Rebind Parameters

■ ST-Plan or Package SQL Statement

■ UA-Plan or Package User Authorization

Accessing Online Help

To display a list of all valid line commands, enter a question mark (?) in the line command field and press Enter.

Page 231: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 12: Identifying Problem SQL

This section contains the following topics:

Accessing the Identify Problem SQL Facility (see page 231) Generating Reports (see page 232) Regenerating Reports from the Historical Database (see page 233) About the Batch Job (see page 234) Filtering Reports (see page 234) Using Line Commands (see page 235)

Accessing the Identify Problem SQL Facility This chapter describes how to search for potential problem SQL statements based on explain output contained in the CA Plan Analyzer historical database.

CA Plan Analyzer writes information to the historical database each time you execute explain processing against an SQL source. A historical version includes enhanced explain reports (when applicable), input statements, and statistics about the explain. The historical version output is stored in the CA Plan Analyzer historical database.

You can use the Identify Problem SQL facility to query the historical database to retrieve information about an SQL source that has been explained. For example, you can determine:

■ Access methods used most frequently by your SQL

■ Most costly SQL statements

■ Statement types frequently used

■ Objects referenced.

Because the Identify Problem SQL facility can access the CA Plan Analyzer historical database, it can provide a specialized, fast-path subset of the Query Explain Database option. For example, with Identify Problem SQL, you can request to view only the SQL that uses a specific access method. With Query Explain Database, CA Plan Analyzer displays all access methods used by all the SQL within a source.

Chapter 12: Identifying Problem SQL 231

Page 232: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Reports

The power of Identify Problem SQL resides in its ability to customize your queries through query configurations. The following briefly lists these configurations:

Element Conjunction

Lets you select the conjunction (AND or OR) for combining the search elements.

Search Elements

Lets you further limit the search for the selected access and data retrieval method types.

After you select the configurations, CA Plan Analyzer generates and displays the search element statistics on the Identify Problem SQL report. This report displays only the SQL that matches the configurations you selected.

To access Identify Problem SQL, enter 12 on the command line on the Main Menu, and press Enter. The Identify Problem SQL panel appears.

The Identify Problem SQL panel is very similar to the display of the Query Explain Database feature. For more information, see the chapter “Querying the Explain Database.”

Generating Reports You can generate the reports of the Identify Problem SQL facility online or in batch.

Note: For more information, see the CA Plan Analyzer Reference Guide.

To generate reports online

1. Access the Identify Problem SQL facility.

For more information, see Accessing the Identify Problem SQL Facility.

2. On the Identify Problem SQL panel, complete the header fields based on the sources to search for problem SQL or rule problems.

For more information, see the online help.

3. In the Report field, indicate the report to generate. Valid values are:

■ EP-Identify Problem SQL report

■ RP-Identify Rule Problems report

4. Press Enter.

A list of search elements displays for the report you selected and a message indicates to select one or more of those elements for the report.

232 User Guide

Page 233: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Regenerating Reports from the Historical Database

5. In the conjunction field, indicate whether to use AND or OR to combine multiple search elements.

6. In the line command field next to the search elements to include in the report, enter S.

7. Press Enter.

The report you selected displays with a list of SQL sources that match the criteria you specified.

To generate reports in batch

1. Access the Identify Problem SQL facility.

For more information, see Accessing the Identify Problem SQL Facility.

2. Complete steps 2 through 6 in the preceding section, to generate reports online.

3. In the command line, enter BATCH.

4. Press Enter.

The Batch Reporting Job Submission panel appears.

5. In the Option field, enter S.

6. Press Enter.

CA Plan Analyzer submits the job to JES and displays an informational message on the Identify Problem SQL panel.

Regenerating Reports from the Historical Database Using this feature, and without exiting the Identify Problem SQL facility, you can regenerate Enhanced Explain reports from information contained in the CA Plan Analyzer historical database.

To regenerate a report

1. Generate a report.

2. For more information, see Generating Reports.

3. On the Identify Problem SQL report panel, enter EXPLRPT at the prompt.

4. Press Enter.

The Historic Database Reporting panel appears.

The displayed list contains each report available in Enhanced Explain.

Note: For more information, see the chapter “Using Quick Explain and Explain Strategy Services” and the CA Plan Analyzer Reference Guide.

Chapter 12: Identifying Problem SQL 233

Page 234: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About the Batch Job

5. Select the reports to generate, indicating long or short form where necessary.

6. Press Enter.

The Historic Database Reporting Options panel appears.

These options are the same as those in Enhanced Explain.

Verify or update the fields as necessary, and press Enter.

7. Proceed to run and review the reports as usual.

8. When you have finished reviewing the Enhanced Explain reports, press PF3 (End).

You are returned to the Identify Problem SQL report panel.

About the Batch Job Unlike in normal Enhanced Explain reports, the Batch Processor input generated by this feature for some reports uses SRCHDRS cards, which rely on a dynamic identification key. They are intended for immediate use-problems can arise if the job is held and the key becomes invalid.

To generate a scheduled batch report, specify a processing mode of Batch.

Filtering Reports You can filter the display of Identify Problem SQL report data according to chosen selection criteria. This is useful in troubleshooting or maintenance scenarios where combing through lengthy reports is undesirable.

To filter report data

1. Specify a Y in the FILTER report header field to display filter criteria panel.

2. Select filter criteria by entering Y or N at each prompt.

Descriptive information is included on the panel.

3. Indicate whether to join the criteria with AND or OR.

4. Press Enter.

The report is generated based on the filter criteria selected.

234 User Guide

Page 235: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

To deactivate report filters, specify an N in the report header field FILTER and press ENTER to regenerate the report without filter criteria specified.

To update the filter criteria

1. Specify a U in the FILTER report header field to display filter criteria panel.

2. Select filter criteria by entering Y or N at each prompt.

Descriptive information is included on the panel.

3. Indicate whether to join the criteria with AND or OR.

4. Press Enter.

The report is generated based on the filter criteria selected.

Using Line Commands You can use line commands to invoke utilities, functions, or reports from the Identify Problem SQL reports. The line command you choose must be appropriate for the object on which to use it on (for example, plan commands for plans and package commands for packages).

Available Line Commands

The following list shows the line commands that are available from the Identify Problem SQL reports. To determine the valid commands for a particular line, see the online help. For more information, see Accessing Online Help.

■ ACC-Access Display

■ B-Bind

■ BO-Bind with Options

■ BR-Bind Parameters

■ CEVN-Compare Explain Version New

■ CEVO-Compare Explain Version Old

■ DEP-Dependency Display

■ DI-Diagram

■ D-Plan Detail

■ DP-Plan Dependency

■ DR-DBRM Detail

■ EDIT-Edit SQL

■ E-Explain

Chapter 12: Identifying Problem SQL 235

Page 236: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

236 User Guide

■ F-Free

■ INFO-Database INFO Display

■ L-Plan List

■ OBJ-Object Report

■ PERF-Performance Database Display

■ PP-Plan Packlist

■ PRED-Predicate Analysis

■ QE-Quick Explain

■ RES-Reset

■ RO-Rebind with Options

■ R-Rebind

■ RR-Rebind Parameters

■ STAT-Statistics Report Display

■ ST-SQL Statement

■ UA-User Authorization

■ X-Explode

Accessing Online Help

To display a list of all valid line commands, enter a question mark (?) in the line command field and press Enter.

Page 237: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 13: Using Plan and Package Utilities

This section contains the following topics:

About the Utilities Option (see page 237) Accessing the Plan/Package Utilities Facility (see page 242) Generating Plan and Package Lists (see page 242) Entering Utility and Subreport Commands (see page 243) Handling Triggers (see page 245) Processing Order (see page 245) Canceling Processing (see page 251) BIND and REBIND with Options (see page 251)

About the Utilities Option This section discusses how to execute a BIND, REBIND, or FREE against plans and packages.

DB2 offers its BIND, REBIND, and FREE commands to maintain your application plans and packages. However, DB2 does not let you execute commands on several plans or packages at once. Why limit yourself when you can use Plan/Package Utilities?

The Utilities option lets you select multiple plans or packages for utility execution and provides maintenance for your plans and packages. With CA Plan Analyzer (PPA), you can use Plan/Package Utilities' BIND, REBIND, or FREE commands from any plan listing or package listing. You can execute the BIND, REBIND, and FREE commands online, in batch mode, or in immediate batch mode.

This section explains the utility commands so you can understand how often you can use BIND, REBIND, and FREE and how the CA Plan Analyzer Plan/Package Utilities can simplify the use of these utility commands.

Chapter 13: Using Plan and Package Utilities 237

Page 238: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About the Utilities Option

Importance of DB2 Utility Commands

The following summarizes how you can use the DB2 BIND, REBIND, and FREE commands to improve your plan's performance:

BIND

The BIND PLAN command lets you build application plans for your DBRMs (Database Request Modules). The BIND PACKAGE command lets you build a package for a single DBRM. Use BIND when the SQL statements associated with the plan or package have changed and when to add new DBRMs or eliminate obsolete DBRMs.

REBIND

This command lets you REBIND plans or packages. REBIND is useful on plans and packages that have had no changes made to their SQL statements but have had changes made to their DB2 subsystem (for example, you have added new indexes). Plans and packages affected by subsystem changes are invalid until you execute a REBIND. Even when a plan or package is not invalid, you can execute a REBIND so that DB2 can access the data more efficiently.

FREE

The FREE command releases the specified application plans and packages from the DB2 catalog. FREE is a powerful command because it deletes the application plan or package, corresponding table entries, and plan or package dependencies from the catalog tables. Unlike DB2, CA Plan Analyzer provides several chances to cancel the FREE command before executing it.

Purpose of Plan/Package Utilities

The Plan/Package Utilities allow BIND, REBIND, and FREE execution on a single plan or package or on multiple plans and packages. DB2 does not offer a collective means of using the utility commands. Without Plan/Package Utilities, you would have to determine which plans or packages were available and individually execute a BIND, REBIND, or FREE for each plan or package.

238 User Guide

Page 239: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About the Utilities Option

Instead of processing a BIND, REBIND, or FREE one plan or package at a time, CA Plan Analyzer offers two types of commands, primary and line, to quickly execute the utilities on multiple plans or packages.

Primary

The primary utility commands use one command to perform utilities on all listed plans and packages. Primary utility commands include BIND, REBIND, and FREEPLAN for plans and BINDPACK, REBINDPACK, and FREEPACK for packages.

In addition to maintaining existing plans and packages, you can create new plans and packages using the ADDPLAN and ADDPACK primary utility commands.

Line

Instead of designating all listed plans and packages, you can use utility line commands to be more selective in choosing plans or packages for a BIND (B), REBIND (R), or FREE (F).

In addition to the convenience of multiple binds and rebinds, the Plan/Package Utilities facility lets you enter BO (BIND with Options) and RO (REBIND with Options) line commands. These let you specify any parameter options from a menu (rather than editing freeform) before binding or rebinding the plans or packages.

Use for Plan/Package Utilities

Plan/Package Utilities provide vital plan or package information. When you use the BIND, REBIND, and FREE commands with Plan/Package Utilities, you can help DB2 access data more efficiently.

Listings

A plan or package selection listing provides a comprehensive viewing of all plans or packages matching your selection criteria. You can switch between locations and DB2 subsystems to change listing.

Basic Information

Plan/Package Utilities offers information to answer many basic questions. For example, is the plan or package still valid or does it have to be rebound? What portion of a table is locked by a plan or package? When are resources acquired and released? Use this information to determine which plans or packages need their parameters modified (for example, ACQUIRE, RELEASE, VALIDATE) before execution to correct performance problems.

Chapter 13: Using Plan and Package Utilities 239

Page 240: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About the Utilities Option

BIND DATE/TIME

Plan/Package Utilities shows when the plan or package was last bound. This information helps when you receive SQL error code -818 stating that your timestamps are not in sync. As a solution, you can check when the plan/package was last bound and REBIND the plan from the plan listing or the package from the package listing.

EXPLAIN (YES)

From the plan or package listing, you can determine whether a plan or package was bound with the EXPLAIN (YES) option. When a plan or package was bound with this option, you can use Plan/Package Reporting's Explain report to view performance and optimization information about the plan or package.

Sub-reports

The Plan/Package Utilities option lets you access any Plan Reporting's reports from the plan listing or any Package Reporting's reports from the package listing. This is useful when you want more detailed information about a specific plan or package.

Other Plan or Package Listings

Many of the CA Plan Analyzer features display a list of plans or packages. Wherever CA Plan Analyzer displays a list of plans or packages, you can use the CA Plan Analyzer utility primary or line commands from that plan or package listing. This is important because you do not need to return to the Plan/Package Utilities listing to execute the commands. Rather, you can intermix subreport commands and utility commands directly from a plan or package listing.

This function is extremely useful when you discover that a plan or package uses a repeatable read or VALIDATE (RUN). It is also useful when a plan or package is invalid or inoperative. These situations can cause performance degradation. Directly from the plan or package listing (for example, from the Identify Problem Plans listing), you can correct the problem plan using the BIND or REBIND commands.

Parameter Listings

Optionally, you can request parameter listings for plans and packages using the BO or RO line commands. The parameter listings let you confirm and change any parameters to be used for the BIND or REBIND commands before the commands are executed. The listings display the parameters, so you do not need to request an EDIT from the Batch Processor Card Display panel to free-form edit them.

Plan/Package Creation

You can create a plan or package by entering the ADDPLAN or ADDPACK primary commands. A parameter listing appears so that you can specify the parameters for the BIND or REBIND.

240 User Guide

Page 241: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

About the Utilities Option

Summary of the Utility Commands

The following summarizes the utility commands that comprise the Plan/Package Utilities facility:

BIND

Primary command to request a BIND of all listed plans.

REBIND

Primary command to request a REBIND of all listed plans.

FREEPLAN

Primary command to request a FREE of all listed plans.

BINDPACK

Primary command to request a BIND of all listed packages.

Note: Triggers (listed with Packages) cannot be bound; they must be rebound. When BINDPACK is issued on a list of packages, any triggers included in the list are ignored.

REBINDPACK

Primary command to request a REBIND of all listed packages.

FREEPACK

Primary command to request a FREE of all listed packages.

Note: Triggers cannot be freed. When this command is issued on a list of packages, any triggers included in the list are ignored.

DROPTRIG

Primary command to request a trigger to be dropped.

ADDPLAN

Primary command to request the creation of a new plan.

ADDPACK

Primary command to request the creation of a new package.

B

Line command to request a BIND of the selected plan or package.

Note: Triggers (listed with Packages) cannot be bound; they must be rebound.

R

Line command to request a REBIND of the selected plan or package.

Chapter 13: Using Plan and Package Utilities 241

Page 242: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing the Plan/Package Utilities Facility

F

Line command to request a FREE of the selected plan or package.

Note: Triggers (listed with Packages) cannot be freed.

BO

Line command to request the BIND parameters for the selected plan or package.

RO

Line command to request the BIND parameters for the selected plan or package.

DTR

Line command to request a drop of a trigger package.

Accessing the Plan/Package Utilities Facility You access the Plan/Package Utilities facility from the Main Menu. Enter 13 on the command line and press Enter. The Plan/Package Utilities Menu appears.

Generating Plan and Package Lists Before you can execute any plan or package utility command, you must generate a list of plans or packages. For more information about commands, see the Entering Utility and Subreport Commands section.

To generate plan and package lists

1. Access the Plan/Package Utilities Menu.

For more information, see Accessing the Plan/Package Utilities Facility.

2. Indicate selection criteria for the plans or packages to include in the list.

■ For plans, fill in Name and Creator.

■ For packages, fill in Collid and Package.

3. Press Enter.

The Plan Utilities or Package Utilities panel appears.

242 User Guide

Page 243: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Entering Utility and Subreport Commands

Entering Utility and Subreport Commands The Plan Utilities List and Package Utilities List panels display information about some of the parameters last used to bind the requested plans or packages. After viewing a plan or package list, you might want to focus on BIND information for a specific plan or package. For example, you could access the BIND Parameters report.

CA Plan Analyzer provides the versatility to move freely between reports to serve your different reporting needs. You can access other reports by using subreport commands from within a report or listing. For example, from the Plan Utilities Listing, you can access Plan Reporting's reports.

You can enter utility commands as primary or line commands to BIND, REBIND, and FREE plans or packages. Subreport commands are line commands that let you access other reports from within a list or report.

Note: You can enter multiple line commands on a plan or package list. For more information, see Processing Order.

The following shows the command line, line command fields, and available commands for the Plan/Package Utilities panel:

PPPKLL ------------ PPA Plan/Package Utilities ----------- COMMAND ===> PP131E: You must enter either plan/creator or collection/package criteria. Plan ===> Creator ===> Collid ===> Package ===> Where ===> N ---------------------------------------------------------------------- Location ===> LOCAL DB2 SSID ===> DFG Version ===> V8R1M0 Enter either plan/creator or collection/package selection criteria above. When the Plan or Package List appears, you can enter the following line commands: Plan/Package Utilities B - BIND plan/package R - REBIND plan/package F - FREE plan/package or any Plan Report line commands on a Plan List or any Package Report line commands on a Package List Press ENTER to process Press END (PF3/15) to quit

Chapter 13: Using Plan and Package Utilities 243

Page 244: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Entering Utility and Subreport Commands

After entering the plan or package to view, the appropriate list panel appears. The following panel shows an example of the PPA Package Utilities panel.

PPPKLM -------------- PPA Package Utilities -------------- 2006/10/12 17:01 COMMAND ===> SCROLL ===> CSR Line 1 of 187 > Collid ===> SQ% Package ===> * Where ===> N ----------------------------------------------------------------- CARDO09 Location ===> LOCAL DB2 SSID ===> D81B Version ===> V8R1M0 CMD PACKAGE COLLECTION OWNER CREATOR QUALIFIER ____ SQA$ADM SQAM072X_SQE CARDO09 CARDO09 CARDO09 ____ SQA$CUOD SQAM072X_SQE CARDO09 CARDO09 CARDO09 ____ SQA$GBS1 SQAM072X_SQE CARDO09 CARDO09 CARDO09

The following describes these areas on the Plan/Package Utilities List panels.

Note: For more information, see the online help and CA Plan Analyzer Reference Guide.

Command line

Enter a primary utility command to perform the same utility function on all plans or packages that appear in the list.

Line command fields

Enter line commands, such as utility and subreport commands.

Available commands

A list of valid utility and subreport commands appears at the bottom of the utilities listing. You can enter any of these commands in the line command fields.

To use primary utility commands

1. Access the Plan/Package Utilities facility.

For more information, see Accessing the Plan/Package Utilities Facility.

2. Generate a list of plans or packages on which to perform the same function.

For more information, see Generating Plan and Package Lists.

3. In the command line, enter a valid primary utility command.

4. Press Enter.

The commands are processed.

For more information, see Processing Order.

244 User Guide

Page 245: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Handling Triggers

To use utility and subreport line commands

1. Access the Plan/Package Utilities facility.

For more information, see Accessing the Plan/Package Utilities Facility.

2. Generate a list of plans or packages.

For more information, see Generating Plan and Package Lists.

3. In the line command fields next to the plans or packages to process, enter valid utility or subreport commands.

4. Press Enter.

CA Plan Analyzer processes the commands.

For more information, see Processing Order.

Handling Triggers A trigger is a set of SQL statements that execute when a certain event occurs in a DB2 table. When a trigger is created by a CREATE TRIGGER statement, a trigger package is created and associated with the table where the triggering event occurs.

Triggers are listed with packages. In reports, the HOSTLANG and PACKAGE TYPE fields set them apart from typical packages by reflecting values of TRIGGER and CREATE TRIGGER, respectively.

Triggers cannot be bound; they must instead be rebound. When the BINDPACK primary command is executed against a package list that contains triggers, the triggers are ignored. An informational message appears indicating this.

Also, triggers cannot be freed.

Processing Order You can enter multiple line commands from the Plan Utilities List or Package Utilities List panel. Keep the following processing guidelines in mind:

■ When you enter both primary and line commands on the Plan Utilities List or Package Utilities List panel, the primary commands take precedence over any line command and are processed first.

■ When CA Plan Analyzer processes line commands, subreport commands take precedence over utility line commands.

Chapter 13: Using Plan and Package Utilities 245

Page 246: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Processing Order

■ CA Plan Analyzer processes subreport commands individually, in the order listed on the plan or package list.

■ CA Plan Analyzer processes utility line commands (B, R, F, BO, RO) collectively. That is, the batch input for all selected plans or packages appears on the Batch Processor Card Display panel.

The following diagram summarizes the processing flow.

246 User Guide

Page 247: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Processing Order

Single Line Command Example

Note: Some sections in this example show only a portion of the input and output for this process.

In the following example, the B line command appears next to plan PAMA:

PPPLM --------------- PPA Plan Utilities --------------- COMMAND ===> SCROLL ===> CSR Name ===> P% Creator ===> * Where ===> N ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D23A Version ===> V2R3M0 CMD PLAN CREATOR BOUNDBY QUALIFIER BINDDATE BINDTIME VALID ____ PAAREGEN xxxxxx xxxxxx xxxxxx YY-MM-DD 14:08 YES B___ PAMA xxxxxx xxxxxx xxxxxx YY-MM-DD 09:51 NO ____ PDMI0100 xxxxxx xxxxxx xxxxxx YY-MM-DD 16:30 YES ____ PDSPTL04 xxxxxx xxxxxx xxxxxx YY-MM-DD 10:41 NO ____ USERxx01 xxxxxx xxxxxx xxxxxx YY-MM-DD 15:01 NO ____ USERxx02 xxxxxx xxxxxx xxxxxx YY-MM-DD 09:43 NO ____ USERxx03 xxxxxx xxxxxx xxxxxx YY-MM-DD 15:34 YES ____ USERxx04 xxxxxx xxxxxx xxxxxx YY-MM-DD 10:48 NO ____ USERxx05 xxxxxx xxxxxx xxxxxx YY-MM-DD 17:32 NO ____ USERxx06 xxxxxx xxxxxx xxxxxx YY-MM-DD 09:23 NO ____ USERxx07 xxxxxx xxxxxx xxxxxx YY-MM-DD 09:25 NO ____ PDT$PLAN xxxxxx xxxxxx xxxxxx YY-MM-DD 09:38 YES

Notice that the plan PAMA is invalid, as indicated by the NO value in Valid. (A plan or package can become invalidated when access paths have changed or when objects that the plan is dependent on have been dropped.)

Press Enter to register the BIND request. CA Plan Analyzer uses the execution mode value specified using the MODE primary command or the Mode field on the Main Menu to process the request. In this example, we use online mode.

Chapter 13: Using Plan and Package Utilities 247

Page 248: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Processing Order

The Batch Processor Card Display panel appears, as shown in the following illustration. This panel displays the batch input used to execute the BIND command.

PPBPD ------- PPA Batch Processor Card Display ------- COMMAND ===> SCROLL ===> CSR Mode ===> O ONLINE The following Batch Processor input has been generated. Press ENTER to process, press END to cancel, or enter the EDIT command to edit. ---------------------------------------------------------------------- xxxxxx ********************************* TOP OF DATA ********************************* .CALL DSN PARM(D81A) .DATA REBIND PLAN ( PAMA ) - OWNER ( xxxxx ) - QUALIFIER ( xxxxxA ) - CACHESIZE ( 1024 ) - - ACTION ( REPLACE ) RETAIN VALIDATE ( RUN ) - ISOLATION ( CS ) ACQUIRE ( USE ) - RELEASE ( COMMIT ) EXPLAIN ( NO ) - - LIBRARY ( 'SYS92205.T095102.RA000.USERxxQ.DBRM' ) - MEMBER ( PAMA ) -

On this panel, you can press Enter to accept the batch input, enter EDIT in the command line to change the BIND parameters, or press PF3 (End) to reject the batch input. In this example, we press Enter to accept the batch input and continue.

248 User Guide

Page 249: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Processing Order

Because the execution mode is online, the AUDIT Message File panel appears, as shown in the following illustration. This panel displays the results of executing the BIND command, so that you can determine the success of the command execution.

BPA.AUDT -------------- AUDIT Message File ------------- COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx .LIST TERM RETCODE = 0 .CONNECT D23A RETCODE = 0 .OPTION NOERRORS RETCODE = 0 .CALL DSN PARM(D23A) .ALLOC UNIT(SYSDA) FI(SYSTSIN) NEW SPACE(2,4) TRACKS + RECFM(F,B) LRECL(80) BLKSIZE(6320) .ALLOC UNIT(SYSDA) FI(SYSTSPRT) NEW SPACE(4,8) TRACKS + RECFM(VBA) LRECL(75) BLKSIZE(6324) .DATA REBIND PLAN ( PAMA ) - OWNER ( xxxxx ) - QUALIFIER ( xxxxxA ) - CACHESIZE ( 1024 ) - - ACTION ( REPLACE ) RETAIN VALIDATE ( RUN ) -

After you have finished reviewing the execution output, press PF3 (End) to return to the Plan Utilities or Package Utilities panel.

Chapter 13: Using Plan and Package Utilities 249

Page 250: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Processing Order

Multiple Line Commands Example

The following shows multiple line commands on the Plan Utilities panel. Notice two utility commands (B and R) and a subreport command (RR) in the line command fields.

PPPLM --------------- PPA Plan Utilities --------------- COMMAND ===> SCROLL ===> CSR Name ===> * Creator ===> * Where ===> N ----------------------------------------------------------------- xxxxxx > Location ===> LOCAL DB2 SSID ===> D23A Version ===> V2R3M0 CMD PLAN CREATOR BOUNDBY QUALIFIER BINDDATE BINDTIME VALID ____ DEFQ5A xxxxxx xxxxxx xxxxxx YY-MM-DD 20:46 YES ____ DEFQ5B xxxxxx xxxxxx xxxxxx YY-MM-DD 21:04 YES ____ DEFQ6A xxxxxx xxxxxx xxxxxx YY-MM-DD 20:47 YES ____ DEFQ6B xxxxxx xxxxxx xxxxxx YY-MM-DD 21:04 YES B___ DEL0211 xxxxxx xxxxxx xxxxxx YY-MM-DD 15:23 NO RR__ DIA22E xxxxxx xxxxxx xxxxxx YY-MM-DD 17:19 YES ____ DLBTIAUL xxxxxx xxxxxx xxxxxx YY-MM-DD 16:40 YES R___ DOCPLAN1 xxxxxx xxxxxx xxxxxx YY-MM-DD 17:58 NO ____ DOCPLAN2 xxxxxx xxxxxx xxxxxx YY-MM-DD 17:58 NO ____ DSNEDCL xxxxxx xxxxxx xxxxxx YY-MM-DD 13:00 YES ____ DSNESPCS xxxxxx xxxxxx xxxxxx YY-MM-DD 13:00 YES ____ DSNESPRR xxxxxx xxxxxx xxxxxx YY-MM-DD 13:00 YES

CA Plan Analyzer processes the commands in the following manner:

■ Subreport command first-In this example, CA Plan Analyzer first processes the REBIND Parameters report (RR) for the DIA22E plan as a subreport. From the REBIND Parameters report, you can enter any of the utility commands or another subreport command.

■ PF3 (End) to continue-To process the next listed command, press PF3 (End). In the example, CA Plan Analyzer processes the utility commands next.

■ Utility commands collectively-CA Plan Analyzer generates batch input to process the utilities requested for DEL0211 and DOCPLAN1. The batch input for both these plans appears on the Batch Processor Card Display panel.

■ Utility confirmation-Confirm the execution of the BIND, REBIND, or FREE commands at the Batch Processor Card Display panel. Press Enter to accept the batch input; press PF3 (End) or enter CANCEL to reject the batch input; or enter EDIT to edit the batch input.

Note: For more information, see the Batch Processor Reference Guide.

250 User Guide

Page 251: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Canceling Processing

Canceling Processing From a subreport, enter CANCEL in the command line to cancel the processing and return to the Plan Utilities or Package Utilities panel. Any unprocessed commands remain listed. You can press Enter to continue processing the remaining commands, or you can press PF3 (End) to return to the Main Menu.

BIND and REBIND with Options The BIND and REBIND utility commands let you specify BIND and REBIND parameters prior to executing the utilities. You can change the parameters used for BIND and REBIND commands by:

■ Issuing the utility commands for the plans or packages. The batch input created for the plans or packages appears on the Batch Processor Card Display panel. From this panel, enter EDIT and edit the batch input to use the BIND and REBIND parameters you want.

■ Using the BO and RO line commands. CA Plan Analyzer lets you enter BO or RO so that you can specify any parameter options that you want before the batch input is generated. This provides more flexibility and helps eliminate any errors that you might incur from editing the batch input.

Using the BO and RO Utility Line Commands

You can enter the BO and RO utility line commands in the line command field for a plan or package within any facility that lists plans or packages. You can enter these commands for individual plans or packages or multiple plans or packages. When you select multiple plans or packages, an options panel appears for each plan or package you select.

Because the processing and the panels are similar for specifying the BIND and REBIND options for plans and packages, the following sections describe how to BIND a plan.

Note: For more information, see the CA Plan Analyzer Reference Guide.

Chapter 13: Using Plan and Package Utilities 251

Page 252: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

BIND and REBIND with Options

Specifying Parameter Options

To use the BO (BIND with Options) command, enter BO at any plan CMD line and press Enter. The BIND PLAN Options panel appears. From this panel, you can select the BIND options to use when CA Plan Analyzer binds the selected plan.

PPPUCPB7 --------------- PPA BIND PLAN Options -------------- COMMAND ===> SCROLL ===> CSR PARAMETERS OPTION VALID OPTIONS PLAN PBAB115Z Application to bind OWNER CANKE01 Authorization ID of plan QUALIFIER CANKE01 Qualifier for unqualified tables CURRENTSERVER D81APTIB Connection to a location PREPARE DEFER NODEFER | DEFER | VALIDATE RUN RUN | BIND | ISOLATION CS RR /RS | UR | CS CACHESIZE 3072 0 - 4096 | EXPLAIN NO NO | YES | ACQUIRE USE USE | ALLOCATE | RELEASE COMMIT COMMIT | DEALLOCATE | CURRENTDATA YES NO | YES | DEGREE 1 1 | ANY | SQLRULES DB2 DB2 | STD | DISCONNECT EXPLICIT AUTOMATIC | EXPLICIT | CONDITIONAL DYNAMICRULES BIND BIND | RUN | BLANK KEEPDYNAMIC NO NO | YES | REOPT ALWAYS NOREOPT | ALWAYS | ONCE DBPROTOCOL PRIVATE DRDA | PRIVATE | BLANK ENCODING 500 ASCII | EBCDIC | UNICODE | CCSID IMMEDWRITE NO NO | YES | PH1 Edit Opthint: OPTHINT ==> Optimization 'hint-id' Edit Path: PATH =====> Edit List: MEMBER ===> LIBRARY ===> PKLIST ===> ******************************* BOTTOM OF DATA ******************************

Note: On the BIND PLAN Options panels, display of certain fields (DYNAMIC RULES, for example) is dependent on the version of DB2 on which you are working.

BIND and REBIND Parameter Options

Enter the value you want used for each BIND parameter. Valid values for each BIND parameter appear to the right of the parameter entry fields. Default values appear first.

Note: For more information, see the CA Plan Analyzer Reference Guide.

252 User Guide

Page 253: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

BIND and REBIND with Options

Edit List

The following describes the Edit List fields on the BIND PLAN Options panel. These fields are available only for the BIND PLAN Options panel.

MEMBER

Enter S to list the names of DBRMs to be included in the application plan. When you press Enter, the MEMBER List Display panel appears. See the List Display panel section for information.

LIBRARY

Enter S to list the partitioned data sets that contain the DBRMs you specified on the MEMBER List Display panel. When you press Enter, the LIBRARY List Display panel appears.

PKLIST

Enter S to list the packages to be included in the package list for the plan. When you press Enter, the PKLIST List Display appears.

Processing

Press Enter to register your selections then press PF3 (End) to continue processing.

■ When you specify binding multiple plans, the BIND PLAN Options for the next plan is displayed. After the last plan has been processed, the Batch Processor Card Display panel appears so you can execute the bind.

■ When you select only one plan to bind, the Batch Processor Card Display panel appears so you can execute the bind.

Listing DBRMs, Libraries, and Packages

The MEMBER List Display panel appears when you enter S in MEMBER from the BIND PLAN Options panel. The MEMBER List Display panel lets you list the DBRMs you want included in the plan to BIND or REBIND.

The LIBRARY List Display panel appears when you enter S in LIBRARY from the BIND PLAN Options panel. The LIBRARY List Display panel lets you list the partitioned data sets that contain the DBRMs you specified on the MEMBER List Display panel. When no partitioned data sets are listed, DB2 uses the library specified on the DBRMLIB DD statement on the generated batch input.

Chapter 13: Using Plan and Package Utilities 253

Page 254: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

BIND and REBIND with Options

The PKLIST List Display panel appears when you enter S in PKLIST on the BIND PLAN Options panel. The PKLIST List Display panel lets you list the packages you want included in the package list for the plan. You are required to enter the location, collection ID, and package name qualifiers that make up the package.

Note: The processing flow and panel layout for each List Display panel are similar. For this reason, we describe only the MEMBER List Display panel.

List Display Panel

A List Display panel lets you list the items necessary for binding or rebinding the plan. The following illustrates the MEMBER List Display panel.

PPPPUMD -------------- PPA MEMBER List Display ------------- COMMAND ===> SCROLL ===> CSR CMD MEMBER MEMBER MEMBER MEMBER MEMBER MEMBER MEMBER ___ FXCAVG__ FXCBCNT_ FXCCNT__ FXCMAX__ FXCMIN__ FXCSTDV_ FXCSTDVS ___ FXCSUM__ FXCVAR__ FXCVARS_ ________ ________ ________ ________ ___ ________ ________ ________ ________ ________ ________ ________ ___ ________ ________ ________ ________ ________ ________ ________ ******************************* BOTTOM OF DATA ********************************

Any DBRMs listed are already included in the selected plan. You can enter the names of any additional DBRMs you want included in the plan. You can list DBRMs anywhere within the panel, entering each DBRM on its own line.

Processing

Press Enter to register your DBRMs. Press PF3 (End) to return to the BIND PLAN Options panel.

Canceling

Enter CANCEL on the command line to ignore any DBRMs you have listed and return to the BIND PLAN Options panel. Any listed DBRMs that were originally included in the plan are still included.

Executing the BIND and REBIND

When you execute the BIND or REBIND, the batch input is displayed on the Batch Processor Card Display panel. From this panel, you can press Enter to execute the batch input. For more information, see the chapter “Introduction.”

254 User Guide

Page 255: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

BIND and REBIND with Options

Chapter 13: Using Plan and Package Utilities 255

Sometimes during the execution of the batch input, errors occur. These errors can arise because of problems like specifying incorrect parameters or entering incorrect library names. When you process the plans or packages, only the plans or packages without errors are processed. You are returned to the BIND/REBIND PLAN/PACKAGE Options panel so you can correct any errors.

SKIP Command

While you are correcting errors, enter SKIP in the command line to skip the Options panel for any plan/package that did not cause an error. This command prevents any error-free plan/packages from being rebound.

PROCESS Command

After you have made corrections to the options for the incorrect plans/packages, enter PROCESS to return to the Batch Processor Card Display panel without having to go through all the Options panels for each plan/package. From this panel you can re-execute the batch input or save the batch input to a data set.

Page 256: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 257: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 14: Create User PLAN_TABLE

This section contains the following topics:

Creating PLAN_TABLEs (see page 257) Creating an Index for PLAN_TABLE (see page 259) Creating Statement and Function Tables (see page 260) Changing the List of User IDs (see page 261) Viewing the Selected User Queue (see page 261) Exiting the Selected User Queue (see page 261) Canceling Batch Input (see page 262) Verifying User Authorizations with CA RC/Query User Reports (see page 262) Accessing the User Reports (see page 263)

Creating PLAN_TABLEs This section shows you how to use the CA Plan Analyzer Create User PLAN_TABLE facility to quickly create multiple PLAN_TABLEs, DSN_FUNCTION_TABLEs, and DSN_STATEMNT_TABLEs.

You can view other users' explain output. However, a PLAN_TABLE is needed for each user who wants to create DB2 explain output. Create User PLAN_TABLE lets you create multiple PLAN_TABLEs, function tables, and statement tables by selecting the user IDs defined for a DB2 subsystem from a selection list. Using CA Plan Analyzer, you do not have to type statements for each user who needs one of these tables.

Using the Create User PLAN_TABLE, you can:

■ Quickly select the users who need these tables. CA Plan Analyzer is not limited to existing user IDs; CA Plan Analyzer lets you enter new user IDs from the user selection list.

■ Specify the databases and tablespaces that must contain the PLAN_TABLEs. You can store several users' PLAN_TABLEs in one database and other users' PLAN_TABLEs in another database. Multiple tablespaces improve performance because one tablespace is not locked for long periods of time.

■ Alter fields with the SQL Editor before a user's PLAN_TABLE, DSN_STATEMNT_TABLE, or DSN_FUNCTION_TABLE is created.

■ Access CA RC/Query when installed on your system directly from the user selection list to check user authorizations quickly.

Chapter 14: Create User PLAN_TABLE 257

Page 258: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating PLAN_TABLEs

DB2 explain output is stored in a table called creator.PLAN_TABLE, where creator is the user ID requesting DB2 explain output. The PLAN_TABLE must exist before you execute explain processing. (The CA Plan Analyzer explain processing features let you create a PLAN_TABLE automatically before explain processing.)

CA Plan Analyzer lets you create one or more user PLAN_TABLEs at one time. The following procedure describes that process. For fields that have a defined list of valid values, see the online help.

To create a PLAN_TABLE

1. In the command line of the Main Menu, type 14 and press Enter. The User PLAN_TABLE Creation panel appears.

2. Fill in the fields on the panel as follows:

■ User-Type the ID of the user you are creating the PLAN_TABLE for, or type selection criteria to generate a list of user IDs to choose from.

■ Database, Tablespace-Type default database and tablespace values for use when plan, statement, and function tables are dynamically created.

■ Create DSN_STATEMNT_TABLE-Indicate whether to create DSN_STATEMNT_TABLE.

■ Create DSN_FUNCTION_TABLE-Indicate whether to create DSN_FUNCTION_TABLE.

■ Create INDEX for PLAN_TABLE-Indicate whether to create an index for the PLAN_TABLE

.

3. Press Enter. The User List panel appears.

4. Enter S next to the user IDs for which to create tables.

5. Press Enter. The User List panel reappears with a message that indicates that your selection has queued.

6. Press PF3 (End) to process queue. The Batch Processor Card Display panel appears, showing the batch input to be used to create the tables.

7. (Optional) To access the SQL Editor to make changes to the batch input, type EDIT in the command line and press Enter.

■ Make the appropriate changes.

■ Press PF3 (End) to return to the Batch Processor Card Display panel.

Note: For more information, see the General Facilities Reference Guide.

258 User Guide

Page 259: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating an Index for PLAN_TABLE

8. Indicate the processing mode for the batch input in the Mode field. Valid values are:

■ O-Online processing.

■ B-Batch processing.

■ I-Immediate batch processing.

9. To process the batch input and create the tables, press Enter. Depending on the processing mode you selected, one of the following occurs:

■ Online processing-The Batch Processor In-Progress panel appears and the batch input executes immediately. After the processing is complete, the Audit Message File appears.

■ Batch processing-CA Plan Analyzer writes the batch input to the Batch Processor data set specified when you entered batch mode.

■ Immediate batch processing-In this mode, you can immediately write the batch input to a data set, submit it, or edit it. The Batch Processor Immediate Batch panel appears so you can specify the disposition of the batch input. For more information, see the chapter “Introduction.”

10. Press PF3 (End). The User PLAN_TABLE Creation panel appears.

11. Press PF3 (End). The Main Menu appears.

Creating an Index for PLAN_TABLE Using the Create User PLAN_TABLE facility, you can create an index for PLAN_TABLE.

To create an index for PLAN_TABLE

1. In User, enter the ID of the user you are creating the PLAN_TABLE for, or type selection criteria to generate a list of user IDs to choose from.

Note: For more information, see Changing the List of User IDs.

2. Enter Y in the Create INDEX for PLAN_TABLE field.

3. Press Enter.

The User List panel appears.

4. Complete the creation process.

For more information, see Creating PLAN_TABLEs; starting with Step 4. The batch input generated will include code for PLAN_TABLE, its index, DSN_STATEMNT_TABLE, and DSN_FUNCTION_TABLE.

Chapter 14: Create User PLAN_TABLE 259

Page 260: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Statement and Function Tables

Creating Statement and Function Tables When user-defined functions are present in SQL, DB2 uses the function table (creator.DSN_FUNCTION_TABLE) to store information about how the function is resolved. A row is put into the table for each function referenced in an SQL statement where:

■ An EXPLAIN is run on an SQL statement which invokes a user-defined function.

■ A program is run whose plan is bound with EXPLAIN(yes), and the program executes an SQL statement that invokes a user-defined function.

The statement table (creator.DSN_STATEMNT_TABLE) holds EXPLAIN results which pertain to a statement's estimated cost. This information is useful for performance tuning when SQL triggers and user-defined functions are present in SQL.

These tables are created by CA Plan Analyzer during Explain if they do not already exist.

To create a DSN_STATEMNT_TABLE and DSN_FUNCTION_TABLE

1. In User, type the ID of the user you are creating the PLAN_TABLE for, or type selection criteria to generate a list of user IDs to choose from.

Note: For more information, see Changing the List of User IDs.

2. Enter Y in the Create DSN_STATEMENT_TABLE and Create DSN_FUNCTION_TABLE fields.

3. Press Enter.

The User List panel appears.

4. Complete the creation process.

For more information, see Creating PLAN_TABLEs. The batch input generated will include code for PLAN_TABLE, DSN_STATEMNT_TABLE, and DSN_FUNCTION_TABLE.

260 User Guide

Page 261: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Changing the List of User IDs

Changing the List of User IDs You can change the selection criteria in the User field to generate a new list of user IDs. This process does not affect the user IDs already stored in the selected user queue.

To change the list of user IDs

1. On the User List panel, enter new selection criteria in the User field.

2. Press Enter.

A list of user IDs displays matching the criteria you specified.

Viewing the Selected User Queue The Selected User Queue panel holds the user IDs until you are ready to process them. To scroll through the queue, press PF7 (Up) and PF8 (Down). To locate a specific user ID, use the FIND scrolling command. For more information, see the online help.

To view the user queue enter S or SHRINK in the command line. Press Enter. The Selected User Queue panel appears.

Exiting the Selected User Queue From the Selected User Queue panel, you can return to the User List panel, cancel all selections, or process all selections.

To return to the User List panel on the command line of the Selected User Queue panel, enter S or SHRINK. Press Enter. Previously selected user IDs remain listed in the queue and do not appear on the User List panel. Selected users are appended to the end of the existing queue.

To cancel all selections, on the command line of the Selected User Queue panel, enter CANCEL and press Enter. The User PLAN_TABLE Creation panel redisplays.

Chapter 14: Create User PLAN_TABLE 261

Page 262: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Canceling Batch Input

Canceling Batch Input During or before step 8 in the procedure you can cancel the batch input before processing. For more information, see Creating PLAN_TABLEs.

To cancel batch input, perform one of the following:

■ Press PF3 (End).

■ Enter CANCEL in the command line and press Enter.

The User PLAN_TABLE Creation panel reappears.

Verifying User Authorizations with CA RC/Query User Reports Users are granted authority by the SQL GRANT statement. There are six forms of the GRANT statement, one for each privilege class. CA RC/Query provides a separate report for each privilege class. The DB2 privilege classes are System, Table, Database, Plan, Package, and User/Resource.

User System Authorization Report

(SA) The User System Authorization report displays system privileges granted to a user. System privileges include the ability to create databases and storage groups, perform BIND ADDs, and run DB2 utilities such as STOSPACE.

User Table Authorization Report

(TA) The User Table Authorization report displays table privileges granted to a user. Table privileges include the ability to alter the table, create table indexes, and add, delete, update, insert, or select rows from the table.

User Database Authorization Report

(DA) The User Database Authorization report displays database privileges granted to a user. Database privileges include the ability to specify administrator, control, or maintenance authority, create tables and table spaces, drop databases, and run database utilities.

User Plan Authorization Report

(PA) The User Plan Authorization report displays the plan bind and execute privileges granted to a user. This report lets you view the DB2 programs a user can execute or bind.

262 User Guide

Page 263: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing the User Reports

Chapter 14: Create User PLAN_TABLE 263

User Package Authorization Report

(KA) The User Package Authorization report displays all the package privileges granted to a user.

User Resource Authorization Report

(RA) The User Resource Authorization report displays the USE privileges held by a user on buffer pools, storage groups, and table spaces (DB2 resources).

Note: You must have CA RC/Query installed to generate the CA RC/Query User Reports. For more information, see the CA RC/Query User Guide or General Facilities Reference Guide.

Accessing the User Reports You can access CA RC/Query user reports using line or primary commands.

To access CA RC/Query user reports using line commands

1. In the line command field next to the user ID to report on, type the line command for the report to generate.

For more information, see the online help.

2. Press Enter.

The selected report appears.

To access CA RC/Query user reports using primary commands

1. On the command line of the User List panel, enter RCQ or QUERY.

2. Press Enter.

The CA RC/Query Main Menu appears.

3. Enter U in the DB2 Object field.

4. Press Enter.

The CA RC/Query User Main Menu appears.

5. Select the appropriate report option (SA, TA, DA, PA, KA, or RA).

6. Press Enter.

The selected report appears.

Page 264: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 265: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 15: Using Statistics Manager

This section contains the following topics:

Accessing Statistics Manager (see page 265) Filtering the List of Statistics Strategies (see page 270) Creating Statistics Strategies (see page 271) Managing DB2 Objects (see page 272) Selecting Objects from the Catalog (see page 273) Specifying Statistics Options (see page 274) Managing Strategy Masks (see page 279) Updating Strategy Masks (see page 280) Deleting Strategy Masks (see page 280) Updating Statistics Strategies (see page 280) Executing Statistics Strategies and Versions (see page 281) Unloading and Loading Data (see page 283) Browsing Statistics Strategies or Strategy Version Definitions (see page 285) Browsing Execution Options (see page 285) Deleting Statistics Strategies or Strategy Versions (see page 286) Toggling the Display of Strategy Versions (see page 286) Viewing the Information Report (see page 287) Viewing Statistics Reports (see page 287) Editing Strategy Statistics (see page 287)

Accessing Statistics Manager This section describes how to use Statistics Manager to manage your DB2 catalog statistics.

The Statistics Manager provides the functionality you need to make DB2 statistics work for you. Statistics Manager's options let you view, calculate, manipulate, and migrate statistics to enhance your DB2 processing. Statistics Manager features include:

■ The ability to migrate statistics from one subsystem to another, such as from PROD to TEST.

■ The ability to migrate statistics from distributed locations and subsystem IDs.

■ Help in creating statistics for a test environment when production statistics do not exist for modeling.

■ A strategy-like feel to the statistics selection and optioning process, including the ability to select statistics by plan or package name.

Chapter 15: Using Statistics Manager 265

Page 266: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing Statistics Manager

■ Automatic calculation of regression and future statistics.

■ Propagation of new cardinality to all related objects (such as indexes and tablespaces).

Note: You must convert statistics data from Statistics Manager version 2.3 and prior to use the strategy, object, and mask data with Statistics Manager r11.

Use statistics strategies to define objects and masks for catalog statistics migration. Although there are many options available, creating a strategy and migrating its statistics can be a straightforward process. The basic steps are:

1. Create the strategy. When you create a statistics strategy, you are creating a shell in which to store object definitions, masks, and statistics extracted from a source DB2 catalog. The catalog you extract statistics from can be for both local and remote DB2 subsystems.

2. Define a list of objects. After creating the strategy, define a list of objects to extract statistics for. The objects can be plans, packages, tables or tablespaces.

3. Execute the strategy. Perform one or more of the available functions.

Optionally, you can:

■ Edit the extracted statistics individually or as a group.

■ Create masks that let you migrate or update statistics to alternate targets.

■ Exit the Statistics Strategies facility without performing any of the execute functions. The strategy is saved for use at a future time.

There are two ways to access Statistics Manager:

■ Through the Main menu.

■ Through the Explain Options-Catalog Statistics options panel.

Accessing Stats Manager Through the Main Menu

To access Statistics Manager from the main menu, enter S on the command line and press Enter. The Statistics Manager Strategy Services panel appears, with the value PSM in the Product field.

266 User Guide

Page 267: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing Statistics Manager

Accessing Stats Manager For a PPA Explain

You can access Statistics Manager through the Explain Options-Catalog Statistics options panel.

To access Stats Manager for a PPA Explain

1. Enter Y in the Catalog Statistics field on any of the following panels:

■ Explain Profile-Explain Options

■ Quick Explain - Explain Options

■ Quick Explain -Source Options

■ Explain Strategy - Explain Options

■ Explain Strategy - Source Options

2. Press Enter.

The Statistics Manager Strategy Services panel appears, with the value PPA in the Product field.

The user must create a PSM statistics strategy. For more information, see Creating Statistics Strategies.

3. Execute this new PSM strategy with function “I” Import.

The import function retrieves the statistics from DB2 catalog based on the objects specified in the PSM strategy and stores these statistics in an internal Stats manager table for later processing. After the import function completes, an import version appears indented underneath the PSM strategy.

4. (Optional) Edit Statistics.

To edit the Statistics, enter line command S next to the import version in the Statistics Manager Strategy Services panel. For more information, see Editing Strategy Statistics.

Chapter 15: Using Statistics Manager 267

Page 268: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing Statistics Manager

The most crucial step is to execute the import version with function “X” Export. This action signals to Stats Manager to return to the PPA explain options panel with the specified export options defined in calculation options and execution options. The following panel examples demonstrate Export function execution.

PSSSM2 ----- Statistics Manager Strategy Services ----- 2002/04/25 17:16 COMMAND ===> SCROLL ===> PAGE LINE 1 OF 3 Strategy ===> PPATEST Creator ===> * Product ===> PPA ----------------------------------------------------------------- xxxxxxx Location ===> LOCAL DB2 SSID ===> D61A Version ===> V6R1M0 STRATEGY S CMD /VERSION DESCRIPTION O CREATOR TY ST PRD DATE TIME _ ________ _________________________ U CARDO09 S PPA _ PPATEST TEST PPA/PSM EXPLAIN U CARDO09 S PPA 2002-04-25 17.15 e 000001 TEST PPA/PSM EXPLAIN U CARDO09 I C PPA 2002-04-25 17.16 ******************************** BOTTOM OF DATA ******************************* Valid CMDS: For Strategies (C,B,D,E,I,L,M,O,U) For Vers (B,D,E,I,M,R,S) Press ENTER to process Press END (PF3/15) to quit

Note: Rollback only occurs during the export operation. To collect rollback statistics, select the option in Update execute options.

268 User Guide

Page 269: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Accessing Statistics Manager

Pressing PF3 (End) from this panel to execute the export returns control back to PPA explain options panel.

PSSXP -------- PSM Strategy Execution Selection ------- 2002/04/25 17:29 COMMAND ===> ------------------------------------------------------------------ xxxxxxx Description ===> TEST PPA/PSM EXPLAIN Import SSID ===> D61A Location ===> LOCAL Export SSID ===> D61A Location ===> LOCAL Select Function ===> X (X) Update Calculation options ===> N (Y/N) Update Execution options ===> N (Y/N) Valid Functions: (X-Export) ENTER to process END (PF3/15) to End

Control has been returned back to PPA explain options.

5. Press Enter to generate the explain cards for the PPA explain.

PPQEEO6 R02.03 ------ PPA Quick Explain - Explain Options ----- 2002/04/2 17:45 COMMAND ===> ---------------------------------------------------------------------- xxxxxxx Database Options ===> N Historical Database Options Primary AUTHID ===> Secondary AUTHID ===> Update SQL Qualifiers ===> N (Override Schemas & SQL/View Qualifiers) Rule Set SSID ===> D61B (Subsystem where Rule Sets are stored) PLAN_TABLE Option ===> R (C - Commit, R - Rollback) Explain Type ===> F (C - Current, F - Future) Plan Explain Option ===> P (D - DBRM, P - Package, B - Both) Non-Catalog Isolation ===> CS Optimization Hint ===> Process Views (Y, N) ===> Y Parallelism Degree ===> Target SSID ===> D61B Target Rule Set ===> @DEFAULT Uppercase Output ===> Y Access Path Filter ===> N Reports ===> Y Search Conditions ===> N Catalog Statistics ===> Y Search Filters ===> N Tie PERFORMANCE Data ===> N Press ENTER to process SAVE to save defaults Press END (PF3/15) to quit

Chapter 15: Using Statistics Manager 269

Page 270: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Filtering the List of Statistics Strategies

The ESTATS explain card is generated from the options specified during the export function in Stats manager in Step 6.

PPBPDIH R02.03 ------- PPA Batch Processor Card Display ------ 2002/04/25 17:46 COMMAND ===> SCROLL ===> PAGE LINE 1 OF 28 ********************************* TOP OF DATA ********************************* .CALL EXPLAIN .DATA RULESSID = (D61B) ACM = (N,CARDO09) VERSION = (LATEST) STRATEGY = (D61A,,CARDO09) PLANTAB = (ROLLBACK) CASE = (UPPER) LINES = (55) PROCDDF = (N) FLOATFMT = (SCI) PROCVIEW = (Y) EXPLTYPE = (FUTURE) PLANEXPL = (PACKAGE) ISOLATE = (CS) TARGET = (D61A(@DEFAULT)) PERFTIE = (N) REPORT = (SUMMARY,COST,ACCESS/SHORT,PREDICATE,PREDICATE/SHORT, PREDICATE/ENTITY,PREDICATE/COMPOUND,TREE,SQLRULE/SHORT, PHYSRULE/SHORT,PHYSRULE,PREDRULE,PLANRULE/SHORT,COMPARE) COMPOPTS = (BBNBE N ,,N) ESTATS = (PPA,PPATEST,CARDO09,SYSIBM,D61A,UPDATE,ROLLBACK, MASK,OPTS=YYYYYNY05,000001, D61A,LOCAL,D61A,LOCAL,U) SRCSQL = (

Filtering the List of Statistics Strategies Use the header fields on the Statistics Manager Strategy Services panel to filter the list of strategies displayed.

To filter the list of statistics strategies, enter values in the indicated fields in the header fields of the Statistics Manager Strategy Services panel:

Strategy

Indicate the name of the strategies to display. You can use selection criteria.

Creator

Indicate the user ID of the creator of the strategies to display. You can use selection criteria.

Product

Indicate the product in which the strategies were created.

270 User Guide

Page 271: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Statistics Strategies

Location

Indicate the location of the DB2 subsystem on which the strategies are located.

DB2 SSID

Indicate the ID of the DB2 subsystem on which the strategies are located.

For fields that have a defined list of valid values, see the online help.

Press Enter.

Statistics Manager displays only the strategies that match the criteria you specified.

Creating Statistics Strategies Use the Statistics Manager Strategy Services panel to define basic information about statistics strategies and access panels on which to define more information, such as objects and masks.

To create a statistics strategy

1. From the create line on the Statistics Manager Strategy Services panel, enter C and values in the indicated fields.

For fields that have a defined list of valid values, see the online help.

■ STRATEGY/VERSION-Enter a name for the strategy.

■ Description-(Optional) Enter a description for the strategy.

■ SO-Indicate the share option for the strategy.

2. Press Enter.

The Statistics Manager Objects panel appears.

3. Complete the procedure described in the Managing DB2 Objects section.

4. (Optional) To specify statistics options, enter OPT on the command line and press Enter.

The PSM Strategy Execution Selection panel appears. Continue with the procedure described in the Specifying Statistics Options section.

5. Press PF3 (End).

The Statistics Manager Object Masks panel appears.

Chapter 15: Using Statistics Manager 271

Page 272: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Managing DB2 Objects

6. (Optional) To create object masks, complete the procedure described in the Managing Strategy Masks section.

7. Press PF3 (End).

Statistics Manager saves the strategy and the Statistics Manager Strategy Services panel appears.

Managing DB2 Objects For a given strategy, you can analyze the statistics of one or more DB2 objects. Use the Statistics Manager Objects panel to manage the list of DB2 objects associated with the current strategy.

To add DB2 objects to the strategy

1. (Optional) In the header fields of the Statistics Manager Objects panel, enter or modify values in the indicated fields.

■ Location-Indicate the location of the DB2 subsystem on which the objects are located.

■ DB2 SSID-Indicate the ID of the DB2 subsystem on which the objects are located.

Note: By default, the values in the Location and DB2 SSID fields are identical to the values indicated in the header fields on the Statistics Manager Strategy Services panel.

■ Share Option-Indicate the share option for the strategy.

■ Function-Enter S.

■ (Optional) Description- Enter a description for the strategy.

For fields that have a defined list of valid values, see the online help.

2. In the create line, enter C and values in the indicated fields.

■ TYPE-Indicate the object type.

■ Plan/Package/DB Name/Creator-Indicate the plan name, package name, database name, or table creator ID. For catalog type, you can enter selection criteria.

■ Collection/TS Name/Table Name-Indicate the collection name, the tablespace name, or table name. For catalog type, you can enter selection criteria.

For fields that have a defined list of valid values, see the online help.

272 User Guide

Page 273: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Selecting Objects from the Catalog

3. Press Enter.

■ When you specify a catalog object type and specify selection criteria, Statistics Manager displays the appropriate object selection panel. Complete the procedure described in the Selecting Objects from the Catalog section.

■ When you specify a non-catalog object type, Statistics Manager adds the object definition to the list.

4. Repeat steps 1 through 3 to add more objects to the strategy.

To remove DB2 objects from the strategy, in the line command field next to the object to remove from the strategy, enter D. Press Enter. Statistics Manager removes the object from the strategy and redisplays the Statistics Manager Objects panel.

Selecting Objects from the Catalog Use the Statistics Manager object selection panels to select one or more objects for your statistics strategy.

To select objects from the catalog

1. On the object selection panel, enter S in the line command field next to the objects to include in the statistics strategy.

2. Press Enter.

An informational message appears indicating that the objects were added to the selection queue.

3. Press PF3 (End).

The Statistics Manager Objects panel appears and the selected objects are added to the list.

Chapter 15: Using Statistics Manager 273

Page 274: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying Statistics Options

Specifying Statistics Options Use the PSM Strategy Execution Selection panel to indicate the options to use in statistics strategy processing.

To specify statistics options

1. On the PSM Strategy Execution Selection panel, enter values in the indicated fields.

■ (Optional) Description- Enter a description for the strategy.

■ Import SSID and Location-Indicate the ID and location of the DB2 subsystem on which the statistics import must take place.

■ Export SSID and Location-Indicate the ID and location of the DB2 subsystem to which the statistics must be exported.

■ Select Function-Indicate the execution function.

Note: When you access the PSM Strategy Execution Selection panel during the creation or update of a strategy, this field is for display only.

■ Update Calculation Options-Indicate whether to update calculation options.

■ Update Execution Options-Indicate whether to update execution options.

■ Update Reporting Options-Indicate whether to update reporting options.

For fields with a defined list of valid values, see the online help.

2. Press Enter.

■ When you choose to update calculation options, the Statistics Manager Calculation Options panel appears. Complete the procedure described in the Updating Calculation Options section.

■ When you choose to update execution options, the Statistics Manager Execution Options panel appears. Complete the procedure described in the Updating Execution Options section.

■ When you choose to update reporting options, the Statistics Manager Reporting Options panel appears. Complete the procedure described in the Updating Reporting Options section.

■ When none of these conditions apply, continue with step 3.

274 User Guide

Page 275: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying Statistics Options

3. Press PF3 (End).

One of the following occurs:

■ If you are creating or updating a strategy, Statistics Manager redisplays the panel from which you accessed the Statistics Manager Execution Selection panel.

■ If you are executing a strategy, the PSM Batch Processor Card Display panel appears.

Updating Calculation Options

To update calculation options

1. Enter Y for Update Calculation Options on the PSM Strategy Execution Selection panel.

The Statistics Manager Calculation Options panel appears.

2. In the Tablespace Calculations fields, enter the indicated values.

■ FREEPAGE-Indicate whether to use the free space FREEPAGE tablespace parameter when calculating statistics.

■ PCTFREE-Indicate whether to use the free space PCTFREE tablespace parameter when calculating statistics.

■ SEGSIZE-Indicate whether to use the SEGSIZE tablespace parameter when calculating statistics.

For fields with a defined list of valid values, see the online help.

3. In the Index Calculations fields, enter the indicated values.

■ FREEPAGE-Indicate whether to use the free space FREEPAGE index parameter when calculating statistics.

■ PCTFREE-Indicate whether to use the free space PCTFREE index parameter when calculating statistics.

For fields with a defined list of valid values, see the online help.

4. In the Column Calculations fields, enter the indicated values.

Note: When you specify Y in both the Cardinality and Growth fields, Statistics Manager uses the Cardinality calculation method

■ Cardinality-Indicate whether to calculate the column cardinality using the old-to-new ratio.

■ Growth-Indicate whether to calculate the new column cardinality by applying a growth percentage.

■ Growth %-(Required when you specify Y in the Growth field) Specify a COLCARD growth percentage.

For fields with a defined list of valid values, see the online help.

Chapter 15: Using Statistics Manager 275

Page 276: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying Statistics Options

5. Press PF3 (End).

■ When you choose to update execution options, the Statistics Manager Execution Options panel appears. Complete the procedure described in the Updating Execution Options section.

■ When you choose to update reporting options, the Statistics Manager Reporting Options panel appears. Complete the procedure described in the Updating Reporting Options section.

■ When neither of these conditions apply, the PSM Strategy Execution Selection panel appears. Continue with step 6.

6. Press PF3 (End). One of the following occurs:

■ If you are creating or updating a strategy, Statistics Manager redisplays the panel from which you accessed the Statistics Manager Execution Selection panel.

■ If you are executing a strategy, the PSM Batch Processor Card Display panel appears.

Updating Execution Options

To update execution options

1. Enter Y for Update Execution Options on the PSM Strategy Execution Selection panel.

The Statistics Manager Execution Options panel appears.

2. Enter values in the indicated fields.

■ Mask Objects-Indicate whether to use masks for the function you specified.

■ Collect Rollback Stats-Indicate whether to collect rollback statistics when the strategy is executed.

■ Save Import-Indicate whether to save imported statistics.

■ Stats Qualifier-Specify the qualifier for non-catalog updates (updates of objects other than SYSIBM).

■ Recalculate Stats-Indicate whether to recalculate statistics.

■ Stats Multiplier-Indicate the propagation multiplier to use.

■ Override-(Required when you specify a value for Stats Multiplier) Indicate whether the multiplier must override current multiplier entries.

For fields with a defined list of valid values, see the online help.

276 User Guide

Page 277: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying Statistics Options

3. Press PF3 (End).

■ If you choose to update reporting options, the Statistics Manager Reporting Options panel appears. Complete the procedure described in the Updating Reporting Options section.

■ If this condition does not apply, the PSM Strategy Execution Selection panel appears. Continue with step 4.

4. Press PF3 (End). One of the following occurs:

■ If you are creating or updating a strategy, Statistics Manager redisplays the panel from which you accessed the Statistics Manager Execution Selection panel.

■ If you are executing a strategy, the PSM Batch Processor Card Display panel appears.

Updating Reporting Options

To update reporting options

1. Enter Y for Update Reporting Options on the PSM Strategy Execution Selection panel.

The Statistics Reports panel appears.

2. Enter values in the appropriate fields to specify whether to report on object statistics for the following tables:

■ SYSTABLESPACE

■ SYSCOLSTATS

■ SYSINDEXES

■ SYSTABLEPART

■ SYSCOLUMNS

■ SYSCOLDISTSTATS

■ SYSTABSTATS

■ SYSSYSKEYS

■ SYSCOLDISTSTATS

■ SYSTABLES

■ SYSCOLDIST

■ SYSLOBSTATS

■ SYSINDEXPART

■ SYSSKEYTARGETS

Chapter 15: Using Statistics Manager 277

Page 278: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Specifying Statistics Options

■ SYSKEYTARGETSTATS

■ SYSKEYTGTDIST

■ SYSKEYTGTDISTSTATS

3. Stats Format-The stats format option will refine the report data by eliminating reports and/or statistics in the reports based on the following criteria:

■ A-Generate reports showing only the Access Path statistics that the optimizer utilizes as defined in the DB2 Administration Guide.

■ S -Generate reports showing only the Space Tuning statistics as defined in the DB2 Administration Guide.

■ B-Generate reports that show all the statistics.

4. Report Format-Indicate the type of report to generate: Detail, Old, New, or Short.

■ D-Generate detailed reports that contain both old and new statistics data.

■ O-Generate reports that contain only old statistics data.

■ N-Generate reports that contain only new statistics data.

■ S-Generate short reports that contain both old and new statistics data.

5. Perform one of the following:

■ To quit without saving, press PF3 (End).

■ To save your changes, press Enter.

The PSM Strategy Execution Selection panel appears.

Press PF3 (End). One of the following occurs:

■ If you are creating or updating a strategy, Statistics Manager redisplays the panel from which you accessed the Statistics Manager Execution Selection panel.

■ If you are executing a strategy, the PSM Batch Processor Card Display panel appears.

278 User Guide

Page 279: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Managing Strategy Masks

Managing Strategy Masks Use the Statistics Manager Object Masks panel and line commands to create, update, template, and delete strategy masks.

To create strategy masks

1. In the create line of the Statistics Manager Object Masks panel, enter C and complete the indicated fields.

TYP

Indicate the mask type.

For fields with a defined list of valid values, see the online help.

2. Complete the Import fields.

Creator/DB Name

(Required for IX, IXC, TB, TBC, TS, and TSD mask types) Indicate a creator name (for indexes and tables) or a database name (for tablespaces). You can use wildcard characters.

IX/TB/TS Name

(Required for IX, IXN, TB, TBN, TS, and TSN mask types) Indicate an index, table, or tablespace name. You can use wildcard characters.

For fields with a defined list of valid values, see the online help.

3. When you are creating a mask to use for exports, complete the indicated Export fields.

Creator/DB Name

(Required for IX, IXC, TB, TBC, TS, and TSD mask types) Indicate a creator name (for indexes and tables) or a database name (for tablespaces). You can use masking characters.

IX/TB/TS Name

(Required for IX, IXN, TB, TBN, TS, and TSN mask types) Indicate an index, table, or tablespace name. You can use masking characters.

SSID

(Optional) Specify a DB2 subsystem ID to limit the masking to a specific subsystem.

Location

(Optional) Specify a location to limit the masking to a specific location.

For fields with a defined list of valid values, see the online help.

4. Press Enter.

The new mask will be added to the list on the Statistics Manager Object Masks panel.

Chapter 15: Using Statistics Manager 279

Page 280: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Updating Strategy Masks

5. Repeat steps 1 through 4 as necessary.

6. Press PF3 (End).

Statistics Manager saves the strategy and the Statistics Manager Strategy Services panel appears.

Updating Strategy Masks You can update strategy masks by completing the following procedure.

To update strategy masks

1. On the Statistics Manager Object Masks panel, modify the values as necessary.

2. Press Enter.

Statistics Manager saves the changes.

3. Press PF3 (End).

Statistics Manager saves the strategy and displays the Statistics Manager Strategy Services panel.

Deleting Strategy Masks To delete strategy masks

1. On the Statistics Manager Object Masks panel, enter D in the line command field next to the mask you want to delete.

2. Press Enter. Statistics Manager deletes the mask and displays a confirmation message.

Updating Statistics Strategies Use the U line command on the Statistics Manager Strategy Services panel to update statistics strategies.

To update a statistics strategy

1. On the Statistics Manager Strategy Services panel, enter in the line command field next to the statistics strategy to update.

2. Press Enter.

The Statistics Manager Objects panel appears for the strategy you selected.

3. Continue with the procedure described in Creating Statistics Strategies.

280 User Guide

Page 281: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Executing Statistics Strategies and Versions

Executing Statistics Strategies and Versions Use the E line command on the Statistics Manager Strategy Services panel to execute a statistics strategy or version. You can execute a strategy with any of three functions:

Import

Use this function to extract statistics. When you import statistics information, you do not need to specify calculation options.

Import/Export

Use this function to extract and update statistics.

Load

Use this function to load statistics from a data set that contains statistics data that was unloaded previously.

You can execute a version with any of the following functions:

Analyze

Use this function to generate statistics reports that show how masks must be applied.

Import

Use this function to extract statistics. When you import statistics information, you do not need to specify calculation options.

Unload

Use this function to unload statistics to a data set.

Export

Use this function to update statistics collected in this version.

To execute a statistics strategy or a strategy version

1. On the Statistics Manager Strategy Services panel, enter E in the line command field next to the strategy or strategy version to execute.

Press Enter.

The PSM Strategy Execution Selection panel (for strategies) appears or the PSM Strategy Vers Execution Selection panel (for versions) appears.

2. Enter values in the indicated fields.

■ Description-(Optional) Specify the description of the strategy or version.

■ Import SSID and Location-Indicate the ID and location of the DB2 subsystem from which to perform the import of data.

Chapter 15: Using Statistics Manager 281

Page 282: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Executing Statistics Strategies and Versions

■ Export SSID and Location-Indicate the ID and location of the DB2 subsystem to which to perform the export of data.

■ Select Function-Indicate the mode in which to execute the strategy or version.

■ Update Calculation Options-Indicate whether to specify or ignore calculation options.

■ Update Execution Options-Indicate whether to specify or ignore execution options.

■ Update Reporting Options-Indicate whether to specify or ignore reporting options.

For fields with a defined list of valid values, see the online help.

3. Press PF3 (End). Do the following:

■ If you choose to update calculation options, the Statistics Manager Calculation Options panel appears. Complete the procedure described in the Updating Calculation Options section.

■ If you choose to update execution options, the Statistics Manager Execution Options panel appears. Complete the procedure described in the Updating Execution Options section.

■ If you choose to update reporting options, the Statistics Manager Reporting Options panel appears. Complete the procedure described in the Updating Reporting Options section.

After you complete these steps (or when these steps do not apply), the PSM Batch Processor Card Display panel appears. Continue with step 5.

Note: When you choose to unload or load data, complete the procedure described in Unloading and Loading Data.

4. In the Mode field, indicate the execution mode to use for this job.

5. Do one of the following:

■ If you specified O for Mode, complete the procedure described in To execute a job in online mode.

■ If you specified B or I for Mode, complete the procedure described in To execute a job in batch mode.

282 User Guide

Page 283: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Unloading and Loading Data

To execute a job in online mode

1. Press Enter. When you specify O for Mode, the Statistics Manager Online Execution panel appears.

2. Press Enter. Statistics Manager submits the batch input, displays a wait panel, and then returns to the Statistics Manager Strategy Services panel.

Note: The PSM Statistical Display panel will appear, after every job execution. Use PF7 (Up) and PF8 (Down) to scroll through the display. After you have viewed the display, press PF3 (End) to return to the Statistics Manager Strategy Services panel.

To execute a job in batch mode, press Enter. When you enter B for Mode, the Batch JCL Specification panel appears.

Note: For more information, see the Batch Processor Reference Guide.

Unloading and Loading Data To unload statistics data

1. Execute a strategy version.

2. Complete the fields on the PSM Strategy Vers Execution Selection panel, being sure to specify U for Select Function.

3. Press Enter.

The Statistics Manager UNLOAD Facility panel appears.

4. Enter values in the indicated fields.

■ UNLOAD Dataset Name-Specify the name of the data set to which to unload the data.

■ Member Name-When the data set is a partitioned data set, specify the name of a member.

Note: The following fields are required only when to unload data to a new data set or member.

Allocation Type-Indicate the allocation unit.

■ Primary Space Allocation-Indicate the primary space quantity to be allocated, in the units specified in the Allocation Type field.

■ Secondary Space Allocation-Indicate the secondary space quantity to be allocated, in the units specified in the Allocation Type field.

■ Volume Name-Indicate the name of the volume onto which the unload file must be loaded.

■ SMS MGMT Class-Indicate the SMS (System Managed Stored) management class for your site.

Chapter 15: Using Statistics Manager 283

Page 284: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Unloading and Loading Data

■ SMS STORAGE Class-Indicate the SMS (System Managed Stored) storage class for your site.

■ SMS DATA Class-Indicate the SMS (System Managed Stored) data class for your site.

For fields that have a defined list of valid values, see the online help.

5. When the unload data set is partitioned, indicate the number of directory blocks.

6. Press Enter. The PSM Strategy Vers Execution Selection panel appears.

7. Press PF3 (End). The PSM Batch Processor Card Display panel appears.

Indicate the execution mode to use for this job. Perform one of the following:

■ Specify O for Mode. Complete the procedure described in To execute a job in online mode.

■ Specify B for Mode. Complete the procedure described in To execute a job in batch mode.

To load statistics data

1. Execute a statistics strategy.

2. Complete the fields on the PSM Strategy Execution Selection panel, being sure to specify L for Select Function.

3. Press Enter.

The Statistics Manager LOAD Facility panel appears.

4. Enter values in the indicated fields. For fields that have a defined list of valid values, see the online help.

■ Dataset Name to LOAD From-Indicate the name of the unload data set from which to load the data.

■ Member Name-When the data set you specified is partitioned, indicate the member name from which to load the data.

5. Press Enter. The PSM Strategy Execution Selection panel appears.

6. Press PF3 (End). The PSM Batch Processor Card Display panel appears.

7. Indicate the execution mode to use for this job in the Mode field.

8. Perform one of the following:

■ If you specified O for Mode, complete the procedure described in To execute a job in online mode.

■ If you specified B for Mode, complete the procedure described in To execute a job in batch mode.

284 User Guide

Page 285: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Browsing Statistics Strategies or Strategy Version Definitions

Browsing Statistics Strategies or Strategy Version Definitions Use the B line command to browse statistics strategies or strategy versions. To view the current statistics options, browse a strategy. To view the statistics options for a previous execution of a strategy, browse a version.

To browse a statistics strategy or strategy version

1. On the Statistics Manager Strategy Services panel, enter B in the line command field next to the statistics strategy or strategy version to browse.

2. Press Enter.

The Statistics Manager Objects panel appears in browse-only mode.

3. Press PF3 (End).

4. The Statistics Manager Object Masks panel appears in browse-only mode.

5. To browse execution options, complete the procedure described in Browsing Execution Options. Otherwise, continue with the next step.

6. Press PF3 (End).

The Statistics Manager Strategy Services panel appears.

Browsing Execution Options During the browsing process, you can use the OPT primary command to browse execution options for a strategy or version.

To browse execution options

1. On the command line, enter OPT.

2. Press Enter.

The PSM Browse Strategy Exec Selection panel appears.

3. Enter the following values in the indicated fields.

■ Browse Calculation Options-Enter Y to browse calculation options; otherwise, enter N.

■ Browse Execution Options-Enter Y to browse execution options; otherwise, enter N.

■ Browse Reporting Options-Enter Y to browse reporting options; otherwise, enter N.

For fields with a defined list of valid values, see the online help.

Chapter 15: Using Statistics Manager 285

Page 286: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting Statistics Strategies or Strategy Versions

4. Press Enter.

The appropriate options panel appears in display-only mode.

5. Press PF3 (End) repeatedly to view the remaining options panels, return to the PSM Browse Strategy Exec Selection panel, and return to the Statistics Manager Strategy Services panel.

Deleting Statistics Strategies or Strategy Versions Use the D line command to delete statistics strategies or strategy versions.

To delete a statistics strategy or a strategy version

1. On the Statistics Manager Strategy Services panel, enter D in the line command field next to the name of the statistics strategy or strategy version to delete.

2. Press Enter.

Statistics Manager deletes the strategy or version, updates the selection list, and displays an informational message.

Toggling the Display of Strategy Versions You can control the display of strategy versions on the Statistics Manager Strategy Services panel. Use the L primary command to expand or shrink the display of versions for all strategies. Use the L line command on the Statistics Manager Strategy Services panel to toggle the display of versions for selected strategies.

To toggle the display of versions for all strategies

1. On the Statistics Manager Strategy Services panel, enter L on the command line.

2. Press Enter.

Statistics Manager toggles the display of versions for all strategies.

To toggle the display of versions for selected strategies

1. On the Statistics Manager Strategy Services panel, enter L in the line command fields next to the strategies you are toggling to see the display of versions.

2. Press Enter.

Statistics Manager toggles the display of versions for only the strategies you selected.

286 User Guide

Page 287: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Viewing the Information Report

Viewing the Information Report Use the I line command on the Statistics Manager Strategy Services panel to view an Information report for a strategy or version.

To view an Information report

1. On the Statistics Manager Strategy Services panel, enter I next to the strategies or versions for which you are viewing an Information report.

2. Press Enter.

The PSM Strategy/Version Information panel appears.

3. Press Enter repeatedly to scroll through the remaining Information reports and redisplay the Statistics Manager Strategy Services panel.

Viewing Statistics Reports Use the R line command on the Statistics Manager Strategy Services panel to view statistics reports for strategy versions.

To view statistics reports

1. On the Statistics Manager Strategy Services panel, enter R in the line command fields next to the versions for which you are viewing reports.

2. Press Enter.

The Statistics Report popup panel appears giving you a choice to choose which statistics reports to report on.

3. Press Enter.

The PSM Statistical Display panel appears a detailed statistics report.

4. Press PF7 (Up) and PF8 (Down) to scroll through the report.

5. Press PF3 (End) to return to the Statistics Manager Strategy Services panel.

Editing Strategy Statistics Statistics Manager provides the flexibility to edit statistics directly before making catalog updates.

Chapter 15: Using Statistics Manager 287

Page 288: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Editing Strategy Statistics

Accessing the PSM Catalog Statistics Editor Panel

Use the S line command on the Statistics Manager Strategy Services panel to access the PSM Catalog Statistics Editor panel.

To access the Catalog Statistics Editor panel

1. On the Statistics Manager Strategy Services panel, enter S next to the strategy version for which you are editing statistics.

2. Press Enter.

The PSM Catalog Statistics Editor panel appears.

Updating Calculation Options

Use the OPTIONS primary command to access the Statistics Manager Calculation Options panel.

To update calculation options

1. On the command line, enter OPTIONS.

2. Press Enter.

The Statistics Manager Calculation Options panel appears.

3. Complete the procedure described in the Updating Calculation Options section of the Specifying Statistics Options chapter.

Viewing Column Statistics

Use the C line command to view the column statistics for the tables and indexes in the object list. When you enter this command for more than one object at a time, Statistics Manager displays the column statistics for each object separately.

To view column statistics

1. In the line command fields next to the objects to view statistics, enter C.

2. Press Enter.

The column statistics appear.

Note: You can explode and shrink the detail display and force, reset, and zero the statistics settings for columns.

288 User Guide

Page 289: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Editing Strategy Statistics

3. Press PF3 (End).

One of the following occurs:

■ When you select only one object, Statistics Manager redisplays the object list.

■ When you select more than one object, the column statistics for another object appear. Continue pressing PF3 (End) until you have viewed the statistics for all the objects you selected.

Controlling the Display

Use line commands and primary commands to control the object display on the PSM Catalog Statistics Editor panel. Statistics Manager lets you expand and collapse the dependent object detail display globally and for selected objects. These commands apply to both object and column statistics lists.

EXPLODE

Expands the display globally. Enter EXPLODE on the command line and press Enter. Statistics Manager expands the detail display for all objects.

SHRINK

Collapses the display globally. Enter SHRINK on the command line and press Enter. Statistics Manager collapses the detail display for all objects.

U

Expands the display for selected objects. In the line command fields next to the objects to expand detail information, enter U. Press Enter. Statistics Manager expands the detail display for the objects you selected.

S

Collapses the display for selected objects. In the line command fields next to the objects to collapse detail information, enter S. Press Enter. Statistics Manager collapses the detail display for the objects you selected.

Calculating and Resetting Object Statistics

Use the CALC primary command to calculate statistics for all objects. When you use this command, the Statistics Editor substitutes default values and statistics values for tables, tablespaces, and indexes are zeroes or negative numbers (because IBM RUNSTATS or CA Database Analyzer PDASTATS has not been run). This command applies only to the object statistics list.

Use the RESET primary command and the R line command to clear any pending catalog updates and reset any statistics values you entered to the current DB2 catalog values. These commands apply to both object and column statistics lists.

Chapter 15: Using Statistics Manager 289

Page 290: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Editing Strategy Statistics

To calculate object statistics enter CALC on the command line of the PSM Catalog Statistics Editor panel. Press Enter. Statistics Manager calculates the object statistics and displays the new values to the left of the catalog values.

To reset statistics globally, enter RESET on the command line and press Enter. Statistics Manager clears any pending catalog updates and resets the statistics values to the current DB2 catalog values.

To reset statistics for selected objects, enter R in the line command fields next to the objects whose statistics to reset and press Enter. Statistics Manager clears the objects' pending catalog updates and resets the statistics values to the current DB2 catalog values.

Forcing Statistics Values

Use the FORCE primary command and the F line command to replace old statistics values with the values you enter for tables, tablespaces, and indexes. These commands let you set statistics values for objects that have not had IBM RUNSTATS or CA Database Analyzer PDASTATS run against them and are useful for adjusting key values, such as cardinality, prior to performing statistics propagation. These commands apply to both object and column statistics lists.

Note: To undo the FORCE and F commands, you must use CANCEL at the end of your edit session, not RESET.

To force statistics values globally, enter FORCE on the command line of the PSM Catalog Statistics Editor panel and press Enter. Statistics Manager replaces the old statistics values for all objects with the values you entered.

To force statistics for selected objects, enter F in the line command fields next to the objects whose statistics values to force and press Enter. Statistics Manager replaces the objects old statistics values with the values you entered.

Setting Statistics to Zero

Use the ZERO primary command and the Z line command to set statistics values for tables, tablespaces, and indexes to zero. Unlike the RESET and R commands, which set values back to their original state prior to the editing session, the ZERO and Z commands always set values to zero. These commands apply to both object and column statistics lists.

290 User Guide

Page 291: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Editing Strategy Statistics

To set statistics to zero globally, enter ZERO on the command line of the PSM Catalog Statistics Editor panel and press Enter. Statistics Manager sets all objects' statistics values to zero.

To set statistics to zero for selected objects, enter Z in the line command fields next to the objects whose statistics values to set to zero and press Enter. Statistics Manager sets the selected objects' statistics values to zero.

Propagating Cardinality and Statistics

Statistics propagation is a major feature of Statistics Manager. This feature lets you use a multiplier to affect the cardinality of extracted statistics and then propagate the new cardinality to dependent objects. Statistics Manager provides two propagation options:

Propagate a value based on the cardinality

Statistics Manager propagates the value to all dependent objects. To use this option, you must enter the P line command and a new cardinality value.

Propagate a multiplier value to all related objects

When you propagate a multiplier, the new cardinality value is actually the result of the multiplier and the existing cardinality value. To use this option, you must enter the X line command and a multiplier value.

You can choose a multiplier appropriate for the statistics scenario you are creating or modifying and propagate that multiplier at the tablespace level and to all dependent objects. Optionally, you can choose to apply a different multiplier to different objects within your scenario. You can also migrate and update the newly propagated statistics to your selected target.

Note: The formulas used to create Statistics Manager's propagation feature are based on the Estimating DB2 Storage Needs section of the IBM DB2 Administration Guide.

To propagate statistics based on cardinality

1. On the PSM Catalog Statistics Editor panel, explode or shrink the detail view as necessary, using the procedures described in the Controlling the Display section.

2. In the line command field next to the table whose statistics to propagate, enter P.

3. CARDF-Enter a new value.

4. Press Enter. Statistics Manager propagates the statistics.

Chapter 15: Using Statistics Manager 291

Page 292: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Editing Strategy Statistics

292 User Guide

To propagate statistics based on a multiplier value

1. On the PSM Catalog Statistics Editor panel, explode or shrink the detail view as necessary, using the procedures described in Controlling the Display.

2. In the line command field next to the tablespace or table whose statistics to propagate, enter X.

3. MULTIPLIER-Enter a multiplier value.

Press Enter. Statistics Manager propagates the statistics.

Page 293: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 16: Maintaining the Source Database

This section contains the following topics:

Accessing the Source Database Maintenance Facility (see page 293) Viewing a Source List (see page 294) Controlling Report Hierarchy (see page 294) Saving SQL Sources (see page 294) Deleting SQL Sources (see page 295) Using Line Commands (see page 296)

Accessing the Source Database Maintenance Facility This section describes the CA Plan Analyzer Source Database Maintenance facility, which is available for maintaining your SQL source database. The Source Database Maintenance facility lets you delete, save, and view information about source entries stored in your historical database.

Your historical database contains all the explains you have created and saved and SQL sources created in other of our products. In the historical database, an SQL source always has SQL text and contains at least one of the following three data types:

■ Explain data, if it was created or updated in CA Plan Analyzer.

■ Dependency data, if it was created or updated in CA Index Expert.

■ Performance data, if it was created or updated in CA Detector.

The Source Database Maintenance facility displays a source list that you control with entries in the header fields. This facility lets you:

■ Delete those sources that you no longer need to save.

■ Save existing sources with new names to prevent overwriting valuable data and to allow for future comparisons.

Working with your historical database and routinely deleting SQL sources that are no longer needed saves disk space and makes it easier for you to work with the SQL sources that you do need to retain and manage. Saving an SQL source with a new name protects valuable data by making a copy with a different name and prevents you from overwriting historical data when you do a new explain.

Chapter 16: Maintaining the Source Database 293

Page 294: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Viewing a Source List

You can access the Source Database Maintenance facility from the Administrative Functions panel.

To access the Source Database Maintenance facility

1. On the Main Menu, enter A in the command line and press Enter. The Administrative Functions panel appears.

2. Enter 1 in the command line and press Enter. The Source Database Maintenance panel appears.

Viewing a Source List Use the header fields on the Source Database Maintenance panel to filter the SQL source list.

To view a list of SQL sources, complete the appropriate header fields based on the SQL source to view and press Enter. A selection list based on your entries appears.

Controlling Report Hierarchy The Source Database Maintenance display is very similar to the display of the Query Explain Database feature. For more information, see the chapter “Querying the Explain Database.”

Saving SQL Sources The Source Database Maintenance facility lets you save hversions of one or more SQL sources.

Note: The following procedures are valid only for manual hversions.

To save SQL sources

1. Generate a list of SQL sources.

For more information, see Viewing a Source List.

2. Enter SAVE in the line command field next to all SQL sources to save.

Press Enter.

The Source Database Save panel appears.

294 User Guide

Page 295: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting SQL Sources

3. Enter data in the following fields:

■ New HVersion-Enter the name for the hversion you are saving.

■ Replace-Enter Y to overwrite an existing hversion with the name you specified in New HVersion.

4. Press Enter.

One of the following occurs:

■ If you choose to save only one SQL source, the Source Database Maintenance panel reappears with the new historical version shown as an entry in the database.

■ If you choose to save multiple SQL sources, CA Plan Analyzer saves the hversion of the source and redisplays the Source Database Save panel for the next SQL source you selected.

5. Repeat steps 3 through 4 for all remaining selected SQL sources.

After you have saved the last selected SQL source, the Source Database Maintenance panel reappears with the new historical versions shown as entries in the database.

Deleting SQL Sources The Source Database Maintenance facility lets you delete hversions of one or more SQL sources.

Note: The following procedures are valid for all hversion types.

To delete SQL sources

1. Generate a list of SQL sources.

For more information, see Viewing a Source List.

2. Enter DEL in the line command field next to the SQL sources to delete.

Press Enter.

Note: If you are deleting a SQL source at the group level, the Database Delete Confirmation panel appears for the SQL source you selected. If you are deleting a SQL source at the object or statement level, no confirmation panel appears.

Press Enter to confirm the deletion.

Chapter 16: Maintaining the Source Database 295

Page 296: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

One of the following occurs:

■ If you choose to delete only one SQL source, CA Plan Analyzer deletes the source and redisplays the Source Database Maintenance panel with an updated selection list.

■ If you choose to delete multiple SQL sources, CA Plan Analyzer deletes the source and displays the Database Delete Confirmation panel for the next SQL source you selected.

3. Repeat step 3 for all remaining selected SQL sources.

After you have deleted the last selected SQL source, the Source Database Maintenance panel reappears with an updated selection list.

Using Line Commands You can use line commands to invoke CA Plan Analyzer utilities functions or reports from the Source Database Maintenance panel. The line command you choose must be appropriate for the object on which you are using it.

List of Available Line Commands

The following shows the line commands available from the Source Database Maintenance panel. To determine the commands valid for a particular line, see the online help. For more information, see Accessing Online Help.

■ A-Alias Dependency

■ ACC-Access Display

■ B-Bind

■ BO-Bind with Options

■ BR-Plan or Package Bind Parameters

■ C-Column Dependency

■ CEVN-Compare Explain Versions New

■ CEVO-Compare Explain Versions Old

■ DB-Database Dependency

■ DEL-Delete Source Database

■ DEP-Dependency Display

■ DI-Diagram Display

■ D-Plan or Package Detail

296 User Guide

Page 297: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Line Commands

Chapter 16: Maintaining the Source Database 297

■ DP-Plan or Package Dependency

■ DR-DBRM Detail

■ EDIT-Edit SQL

■ E-Plan or Package Explain

■ F-Free

■ I-Index Dependency

■ INFO-Database INFO Display

■ L-Plan or Package List

■ OBJ-Object Report

■ PERF-Performance Database Display

■ PI-DBRM Plan or Package Inclusion

■ PRED-Predicate Analysis

■ QE-Quick Explain

■ QOFF-QOFF

■ QON-QON

■ RES-Reset

■ RO-Rebind with Options

■ R-Rebind

■ RR-Plan or Package Rebind Parameters

■ S-Synonym Dependency

■ STAT-Statistics Report Display

■ ST-Plan, Package, or DBRM SQL Statement

■ TS-Tablespace Dependency

■ T-Table Dependency

■ UA-Plan or Package User Authorization

■ V-View Dependency

■ X-Explode

Accessing Online Help

To display a list of all valid line commands, enter a question mark (?) in the line command field and press Enter.

Page 298: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 299: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 17: Maintaining Stored Procedures

This section contains the following topics:

Accessing the Stored Procedures Maintenance Facility (see page 299) Creating Stored Procedures Using Saved Variables (see page 300) Using Options (see page 301) Browsing Stored Procedures (see page 306) Starting Stored Procedures (see page 307) Operations Supported by Primary Commands (see page 307) Operations Supported by Line Commands (see page 308)

Accessing the Stored Procedures Maintenance Facility This section describes methods for creating, updating, executing, and maintaining stored procedures and the DB2 SYSIBM.SYSPROCEDURES table.

This facility provides one-stop panel control for creating, updating, browsing, deleting, and starting stored procedures and for maintaining your DB2 SYSIBM.SYSPROCEDURES table.

The Stored Procedures Maintenance facility provides:

■ DB2 command processing capabilities for START, STOP, and DISPLAY.

■ Audit trail functionalities with last action and user information for every stored procedure.

■ A user-friendly editor for stored procedures.

Note: You must have SYSADM authority or procedure maintenance authority to perform any operations in the Stored Procedures Maintenance facility. If you only have procedure maintenance authority, you can update SYSIBM.SYSPROCEDURES, but you are not able to perform DB2 actions (such as START or STOP) on the stored procedures. For more information, see the General Facilities Reference Guide.

Chapter 17: Maintaining Stored Procedures 299

Page 300: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Stored Procedures Using Saved Variables

Access the Stored Procedures Maintenance facility from the Administrative Functions panel.

To access the Stored Procedures Maintenance panel

1. On the Main Menu, enter A in the command line.

2. Press Enter.

The Administrative Functions panel appears.

3. Enter 2 in the command line.

4. Press Enter.

The Stored Procedures Maintenance panel appears.

------ PPA Stored Procedures Maintenance ----- COMMAND ===> SCROLL ===> CSR Schema ===> % Name ===> U% --------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D71A Version ===> V7R1M0 CREATED SPECIFIC ROUTINE CMD SCHEMA NAME OWNER BY NAME ID ___ ________ __________________ ___ SYSPROC xxxxxx xxxxxx xxxxxx xxxxxx ___ SYSADM xxxxxx xxxxxx xxxxxx xxxxxx ___ SYSPROC xxxxxx xxxxxx xxxxxx xxxxxx ___ USERxx xxxxxx xxxxxx xxxxxx xxxxxx ___ SYSPROC xxxxxx xxxxxx xxxxxx xxxxxx ___ SYSPROC xxxxxx xxxxxx xxxxxx xxxxxx ___ SYSPROC xxxxxx xxxxxx xxxxxx xxxxxx ******************************** BOTTOM OF DATA ****************************

Creating Stored Procedures Using Saved Variables CA Plan Analyzer lets you create stored procedures using ISPF profile saved defaults from your last saved variables.

Note: The first time you use Stored Procedure Maintenance you could receive the following warning message:

PP406W: There was a problem on the Call to ISPF. Processing continues.

This is a warning informing you that ISPF variables could not be retrieved. To make sure you do not receive this message again, enter the SAVE command on the second creation panel of stored procedure options, the Procedure Creation Options panel.

300 User Guide

Page 301: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Options

To create a stored procedure using last saved defaults

1. Access the Stored Procedures Maintenance facility.

For more information, see Accessing the Stored Procedures Maintenance Facility.

The Stored Procedures Maintenance panel appears.

2. Enter the following values in the indicated fields:

■ Enter C in the CMD field.

■ Enter a unique name for your stored procedure in the SCHEMA and NAME fields.

3. Press Enter.

The procedure creation panel appears.

4. Enter changes.

5. Press Enter again to process the stored procedure Batch Processor cards.

Using Options CA Plan Analyzer also specifies several options for the stored procedures you create.

To create a stored procedure using options

1. Access the Stored Procedures Maintenance facility.

For more information, see Accessing the Stored Procedures Maintenance Facility.

The Stored Procedures Maintenance panel appears.

2. Enter the following values in the indicated fields:

■ Enter C in the CMD field.

■ Enter a unique name for your stored procedure in the SCHEMA and NAME fields.

3. Press Enter.

The procedure creation panel appears.

To further describe the stored procedure, enter values in the indicated fields. For fields that have a defined list of valid values, see online help. Press PF1 (Help) or enter HELP on the command line to access online help.

Chapter 17: Maintaining Stored Procedures 301

Page 302: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Options

The following are the options that appear on the panel of stored procedure creation options and parameters.

■ SQL PROCEDURE-Enter Y if the stored procedure is to be an SQL procedure. Enter N if the stored procedure is to be an external procedure.

Note: While SQL procedures and external procedures share some options, they do not share all options.

■ LANGUAGE-Specify the programming language in which the stored procedure is written. Valid languages for external stored procedures are:

– ASSEMBLER

– C

– COBOL

– COMPJAVA (V7)

– JAVA

– PLI

– REXX

SQL is the only valid language for SQL stored procedures.

■ PARAMETER STYLE-Choose the linkage convention the product will use when passing parameters to the stored procedure. The following are valid style values:

– DB2-for DB2SQL

– GEN-for General

– GENN-for General with Nulls

Note: If you specified REXX as the LANGUAGE option, then you must specify GEN or GENN as the style option.

■ JAVA-for Java

If you specified COMPJAVA as the LANGUAGE option, then you can specify JAVA as the style option.

■ PROGRAM TYPE-Specify if the stored procedure is to run as a main routine or a subroutine. Choose from the following valid types:

– M-Run the stored procedure as a MAIN routine.

– S-Run the stored procedure as a SUBroutine.

Note: If you specified REXX or JAVA as the LANGUAGE option, then you must specify SUB as the program type.

302 User Guide

Page 303: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Options

■ COLLID-Edit and enter a string of run options for the stored procedure. Choose from the following valid types:

– Y-Package collection is used.

– N-Package collection is not used. A NO COLLID card will be generated for the CREATE PROCEDURE.

– U-ENTER/EDIT/BROWSE Package collection.

■ DBINFO-Specify whether DB2 information is to be passed to the stored procedure.

– Y-(Yes) Generate the DBINFO card for the CREATE PROCEDURE.

– N-(No) Generate the NO DBINFO card for the CREATE PROCEDURE.

Note: If you specified SQL or JAVA as the LANGUAGE option, then you must specify N for DBINFO.

■ DETERMINISTIC-Specify if the stored procedure is to return the same results from successive calls with identical input parameters.

– Y-(Yes) Generate the DETERMINISTIC card for the CREATE PROCEDURE.

– N-(No) Generate the NOT DETERMINISTIC card for the CREATE PROCEDURE.

■ ASUTIME LIMIT-Specify a value for the total amount of CPU service units that a single execution of the stored procedure can run.

– nn-Generate the ASUTIME LIMIT nn card for the CREATE PROCEDURE where nn is the limit number.

– 0-Generate the ASUTIME NO LIMIT card for the CREATE PROCEDURE.

■ WLM Environment-Specify the name of the Work Load Manager that is to be used for the stored procedure.

– blank-Generate a NO WLM ENVIRONMENT card for the CREATE PROCEDURE.

– name-Generate a WLM ENVIRONMENT name card for the CREATE PROCEDURE.

■ SECURITY-Specify the security to be used for the stored procedure.

– D-DB2 security

– U-User security

– F-Definer security

Chapter 17: Maintaining Stored Procedures 303

Page 304: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Options

■ RUN OPTIONS-Edit or enter a string of run options for the stored procedure.

– Y-Run options is used.

– N-Run options is not used.

– U-ENTER/EDIT/BROWSE Run options.

■ PARAMETER LIST-Edit or enter a string of parameters for the stored procedure.

– Y-Parameter list options is used.

– N-Parameter list options is not used.No parameters.

– U-ENTER/EDIT/BROWSE Parameter List options.

■ EXTERNAL NAME-Edit or enter an EXTERNAL name for the stored procedure.

– Y- External name options is used.

– N- External name options is not used.

– U- ENTER/EDIT/BROWSE External name options.

■ CALLED ON NULL INPUT-Specify that a call can be made to the stored procedure even if any of the arguments passed are null.

– Y-Generate the CALLED ON NULL INPUT card for the CREATE PROCEDURE.

– N-Do not generate the CALLED ON NULL INPUT card for the CREATE PROCEDURE.

■ FENCED-Specify that the stored procedure will be executed in an external address space to insure that the stored procedure will not corrupt DB2 storage.

– Y-Generate the FENCED card for the CREATE PROCEDURE.

– N-Do not generate the FENCED card for the CREATE PROCEDURE.

■ COMMIT ON RETURN-Specify whether DB2 will, on return, perform a COMMIT on the actions of the stored procedure.

– Y-Generate a COMMIT ON RETURN YES card for the CREATE PROCEDURE.

– N-Generate a COMMIT ON RETURN NO card for the CREATE PROCEDURE.

304 User Guide

Page 305: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Using Options

■ STAY RESIDENT-Specify whether the stored procedure load module must remain resident in memory after execution.

– Y-Generate the STAY RESIDENT YES card for the CREATE PROCEDURE.

– N-Generate the STAY RESIDENT NO card for the CREATE PROCEDURE.

■ DYNAMIC RESULT SET-Specify the maximum number of query result sets that the stored procedure can return.

– nn-Generate the DYNAMIC RESULT SETS nn card for the CREATE PROCEDURE where nn is the limit number.

– 0-Specify that no result sets will be returned.

■ SPECIAL REG-Specify whether special registers must be inherited or initialized, based on DB2 rules. You have two valid options:

– I-Inherit special registers.

– D-Default special registers.

■ SQL DATA-Specify whether the stored procedure can execute SQL statements and , if so, what types. You have four valid options:

– M-Modifies SQL data.

– N-No SQL data.

– C-Contains SQL data.

– R-Reads SQL data.

■ PARAMETER CCSID-Specifies whether the encoding scheme for string parameters is ASCII, EBCDIC, or Unicode. You have three valid options:

– A-ASCII

– E-EBCDIC

– U-Unicode

Chapter 17: Maintaining Stored Procedures 305

Page 306: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Browsing Stored Procedures

■ ACTION FAILURE- Specifies whether the routine is to be put in stopped state after some number of failures. There are three valid options for ACTION FAILTURE:

– D-Specifies that this routine must be placed in stopped state after the number of failures indicated by the value of field MAX ABEND COUNT on installation panel DSNTIPX. This is the default.

– N-Specifies that this routine must be placed in stopped state after NN of failures. The value NN can be integer from 1 to 32767.

– C-Specifies that this routine must not be placed in stopped state after any failure.

■ ACTION FAILURE COUNT -Specifies an allowable number of failures for this routine (0-32767). If 0 is specified, the routine will never be stopped. If no value is specified for this routine, the default will be -1 to indicate that the DB2 installation parameter (STORMXAB) will be used.

Note: For more information, see the IBM SQL Reference Guide.

4. Press Enter to complete and validate the panel of stored procedure options and parameters.

CA Plan Analyzer generates and displays control cards from the options you selected. These control cards will create the stored procedure.

Browsing Stored Procedures The Stored Procedure Maintenance facility browses stored procedures without updating them. The browsing facility includes the following panels.

■ Procedure Browse-This panel is identical to the Procedure Creation panel.

■ Run Options-This panel displays any existing run options. If the selected stored procedure does not have Run options, no panel will display.

■ EXTERNAL NAME-This panel displays any existing Extername name. If the selected stored procedure does not have an EXTERNAL NAME, no panel will display.

To browse stored procedures

1. Access the Stored Procedures Maintenance facility

For more information, see Accessing the Stored Procedures Maintenance Facility.

The Stored Procedures Maintenance panel appears.

2. Enter B in the line command field next to the stored procedure to browse.

306 User Guide

Page 307: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Starting Stored Procedures

3. Press Enter.

The Procedure Browse panel appears.

4. Enter values in the following fields:

■ Browse EXTERNAL NAME ==> U (Y/N/U)

■ Browse RUN OPTIONS ==> U (Y/N/U)

Starting Stored Procedures To start a stored procedure

1. Access the Stored Procedures Maintenance facility.

For more information, see Accessing the Stored Procedures Maintenance Facility.

The Stored Procedures Maintenance panel appears.

2. Enter SR in the line command field next to the stored procedure to start.

Press Enter.

The stored procedure you selected is started.

3. (Optional) Enter the D (Display) command to check the status of the started stored procedure.

Note: The stored procedure must be located in the DB2 system catalog.

Operations Supported by Primary Commands The following sections discuss additional Stored Procedure Maintenance facility operations that are supported by Primary commands.

To perform any of these operations, enter the command in the command line of the Stored Procedures Maintenance panel and press Enter.

Note: For more information, see the online help, press PF1 (Help), or enter HELP.

Chapter 17: Maintaining Stored Procedures 307

Page 308: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Operations Supported by Line Commands

Operations Supported by Line Commands The following sections discuss additional Stored Procedure Maintenance facility operations that are supported by line commands.

To perform any of these operations, enter the command in the line command field of the Stored Procedures Maintenance panel and press Enter.

For more information, see the online help, press PF1 (Help), or enter HELP.

DISPLAYALL Command

Use the DISPLAYALL command to display DB2 command processor output and show the IBM status for each stored procedure in the current listing of stored procedures. The following shows an example of this output:

-------------- PPA DB2 Command Display ------------- COMMAND ===> SCROLL ===> CSR LINE 137 OF 482 ------- SCHEMA=CREATE1 DSNX9DIS PROCEDURE LNAME_RUNOPTS HAS NOT BEEN ACCESSED OR IS NOT DEFIN DSNX9DIS PROCEDURE LNAME_PRAMLIST HAS NOT BEEN ACCESSED OR IS NOT DEFI ------- SCHEMA=CREATE3 DSNX9DIS PROCEDURE LNAME_RUNOPTS732 HAS NOT BEEN ACCESSED OR IS NOT DE ------- SCHEMA=CRESTE4 DSNX9DIS PROCEDURE LNAME_RUNOPTS HAS NOT BEEN ACCESSED OR IS NOT DEFIN ------- SCHEMA=GINNA01 PROCEDURE STATUS ACTIVE QUED MAXQ TIMEOUT FAIL WLM_ENV CBASERT3 STARTED 0 0 1 0 0 D81AWLM DSNX9DIS PROCEDURE CAW HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE CAW2 HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE CAW4 HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE ERT3 HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE CAWOR HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE ASERT3 HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE BASERT3 HAS NOT BEEN ACCESSED OR IS NOT DEFINED DSNX9DIS PROCEDURE CAWORLD_INSERT2 HAS NOT BEEN ACCESSED OR IS NOT DEF ------- SCHEMA=HENPE01 DSNX9DIS PROCEDURE ET100P HAS NOT BEEN ACCESSED OR IS NOT DEFINED Press END (PF3/15) to quit

When you have finished viewing this information, press PF3 (End). The Stored Procedures Maintenance panel appears.

308 User Guide

Page 309: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Operations Supported by Line Commands

STARTALL Command

Use the STARTALL command to start all stored procedures located in the DB2 catalog and displayed on the current panel.

STOPALL Command

Use the STOPALL command to stop all stored procedures located in the DB2 catalog and displayed on the current panel.

D (Display)

Use the D line command to display the DB2 command processor output for a particular stored procedure. The following is an example of the output:

-------------- PPA DB2 Command Display ------------- COMMAND ===> SCROLL ===> PAGE LINE 1 OF 9 ********************************* TOP OF DATA ********************************* DSNX940I !D81A DSNX9DIS DISPLAY PROCEDURE REPORT FOLLOWS - ------- SCHEMA=ARZ7SP1 PROCEDURE STATUS ACTIVE QUED MAXQ TIMEOUT FAIL WLM_ENV DBXSEC STARTED 0 0 1 0 0 D81AWLM DSNX9DIS DISPLAY PROCEDURE REPORT COMPLETE DSN9022I !D81A DSNX9COM '-DISPLAY PROC' NORMAL COMPLETION ******************************** BOTTOM OF DATA *******************************

The following describes the fields on the DB2 Command Display. All fields are for display only.

SCHEMA

The schema name of this stored procedure.

PROCEDURE

The name of this stored procedure.

Chapter 17: Maintaining Stored Procedures 309

Page 310: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Operations Supported by Line Commands

STATUS

The status of this stored procedure. Valid values are:

■ STARTED-Calls for this procedure can be processed.

■ STOPQUE-Calls for this procedure are queued.

■ STOPREJ-Calls for this procedure are rejected.

■ STOPABN-Calls for this procedure are rejected because of an abnormal termination.

ACTIVE

The number of threads currently running in the load module.

QUED

The number of threads waiting for this stored procedure to be scheduled.

MAXQ

The maximum number of threads that have concurrently waited for this procedure to be scheduled.

TIMEOUT

The number of times an SQL CALL statement has timed out waiting for a request for this stored procedure to be scheduled. The last line of the report is an informational message from DB2.

WLM_ENV

The Work Load Manager defined for the displayed stored procedure.

FAIL (V8)

The number of times a procedure has failed. DB2 resets this value to zero each time you run the START PROCEDURE command.

SR (Start)

Use the SR line command to start a stored procedure from the DB2 system catalog.

ST (Stop)

Use the ST line command to stop a stored procedure from the DB2 system catalog.

310 User Guide

Page 311: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Operations Supported by Line Commands

Chapter 17: Maintaining Stored Procedures 311

B (Browse)

Use the B line command to browse a stored procedure from the DB2 system catalog.

Page 312: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 313: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 18: Maintaining Auto HVersions

This section contains the following topics:

Accessing the Auto HVersion Maintenance Feature (see page 313) Creating Auto HVersion Definitions (see page 314) Filtering the Selection List (see page 315) Updating Auto HVersion Definitions (see page 316) Browsing Auto HVersion Definitions (see page 316) Deleting Auto Hversion Definitions (see page 317)

Accessing the Auto HVersion Maintenance Feature The Auto HVersion Maintenance facility defines values forCA Plan Analyzer to use when generating hversions automatically.

You can access the Auto HVersion Maintenance facility from the Administrative Functions menu.

To access Auto HVersion Maintenance

1. On the Main Menu, enter A in the command line.

2. Press Enter.

The Administrative Functions panel appears.

3. Enter 3 in the command line.

4. Press Enter.

The Auto HVersion Maintenance panel appears.

Chapter 18: Maintaining Auto HVersions 313

Page 314: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating Auto HVersion Definitions

Creating Auto HVersion Definitions Using the Auto HVersion Creation/Update and Auto HVersion Options panels, you can create auto hversion definitions.

To create a new auto hversion definition

1. Access the Auto HVersion Maintenance panel.

For more information, see Accessing the Auto HVersion Maintenance Feature.

2. Type the following values in the indicated fields of the create line.

■ Line command field-Enter C.

■ Hversion-Enter the name for the new hversion.

■ Description-Enter a description of the new hversion.

■ SO-Indicate the share option for the new hversion.

For fields that have a defined list of valid values, see the online help.

3. Press Enter.

The Auto HVersion Creation/Update panel appears.

4. To define basic options for the auto hversion definition, enter values in the indicated fields. For fields that have a defined list of valid values, see the online help.

■ Source SSID-Enter the ID of the DB2 subsystem that the Explain will be limited to. This field has no effect when left blank.

■ Source Qualifier-Specify a value that matches the QUALIFIER parameter on the BIND statement. This limits the explain to only those plans and packages with a matching qualifier value. This field has no effect when left blank.

■ Package Replacement-Indicate whether to replace the package in the CA Plan Analyzer database when this auto hversion definition is used to generate a new hversion.

■ Number of Versions Kept-Indicate the number of hversions to maintain. You can specify a minimum of 1 and a maximum of 99.

Note: The Package by Version Date, Change Method BINDTIME, and Write to Dataset Always fields are currently not used.

5. Press PF3 (End).

The CA Plan Analyzer Auto HVersion Options panel appears.

314 User Guide

Page 315: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Filtering the Selection List

6. To specify more options for auto hversion creation, enter values in the indicated fields.

■ FUTURE or CURRENT-Indicate the type of explain to perform.

■ Target SSID-Indicate the ID of the DB2 subsystem where the explain must take place.

■ Predicate Analysis, SQL Rules Analysis, Physical Rules Analysis, Plan Rules Analysis, and Predicate Rules Analysis-Indicate whether to perform the analyses.

■ Rule Set-Indicate the name of the rule set to use for rules analysis.

■ SSID for Rule Set-Indicate the ID of the DB2 subsystem where the rule set is located.

For fields that have a defined list of valid values, see the online help.

7. Press PF3 (End).

CA Plan Analyzer creates the auto hversion definition and redisplays the Auto HVersion Maintenance panel.

Filtering the Selection List Using the header fields, you can filter the selection list to contain only the auto hversion definitions to browse, delete, or update.

To filter the selection list

1. Access the Auto HVersion Maintenance panel.

For more information, see Accessing the Auto HVersion Maintenance Feature.

2. Enter values in the header fields to specify filtering criteria.

■ HVERSION-Indicate criteria for the auto hversion definition name.

■ Creator-Indicate criteria for the creator ID.

You can use selection criteria. For more information about selection criteria, see the online help

3. Press Enter.

CA Plan Analyzer updates the list of existing auto hversion definitions, based on the criteria you specified.

Chapter 18: Maintaining Auto HVersions 315

Page 316: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Updating Auto HVersion Definitions

Updating Auto HVersion Definitions After you have specified options for an auto hversion definition, you can modify them using the same series of panels.

To update an existing auto hversion definition

1. Access the Auto HVersion Maintenance panel.

2. (Optional) Filter the selection list.

For more information, see Filtering the Selection List.

3. Enter U in the line command field next to the auto hversion definition to update.

4. Press Enter.

The Auto HVersion Creation/Update panel appears.

5. See the Creating Auto HVersion Definitions section and follow the instructions in steps 4 through 6.

6. Press PF3 (End).

CA Plan Analyzer saves the modified auto hversion definition and the Auto HVersion Maintenance panel appears.

Browsing Auto HVersion Definitions The Auto HVersion Maintenance facility browses auto hversion definitions without updating them. The browsing facility includes:

■ Auto HVersion Browse panel-A display-only version of the Auto HVersion Creation/Update panel.

■ Browse Auto HVersion Options panel-A display-only version of the Auto HVersion Options panel.

To browse an existing auto hversion definition

1. Access the Auto HVersion Maintenance panel.

For more information, see Accessing the Auto HVersion Maintenance Feature.

2. (Optional) Filter the selection list.

For more information, see Filtering the Selection List.

3. In the line command field next to the auto hversion definition to browse, enter B.

316 User Guide

Page 317: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting Auto Hversion Definitions

Chapter 18: Maintaining Auto HVersions 317

4. Press Enter.

The Auto HVersion Browse panel appears.

5. After you have finished browsing this information, press PF3 (End).

The Browse Auto HVersion Options panel appears.

6. After you have finished browsing the options information, press PF3 (End).

The Auto HVersion Maintenance panel appears.

Deleting Auto Hversion Definitions The Auto HVersion Maintenance facility deletes auto hversion definitions that you no longer want to use.

To delete an existing auto hversion definition

1. Access the Auto HVersion Maintenance panel.

For more information, see Accessing the Auto HVersion Maintenance Feature.

2. (Optional) Filter the selection list.

For more information, see Filtering the Selection List.

3. In line command field next to the auto hversion definition to delete, enter D.

4. Press Enter.

CA Plan Analyzer deletes the auto hversion definition and automatically updates the selection list.

Page 318: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 319: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 19: Maintaining Explain Profiles

This section contains the following topics:

Accessing the Explain Profile Maintenance Feature (see page 319) Creating New Explain Profiles (see page 319) Filtering the Selection List (see page 321) Updating Existing Explain Profiles (see page 321) Browsing Existing Explain Profiles (see page 322) Deleting Explain Profiles (see page 323)

Accessing the Explain Profile Maintenance Feature The Explain Profile Maintenance option creates profiles containing default values for Quick Explain and Explain Strategy Services functions. You can override the values from a profile using the Explain Options panels.

You can access the Explain Profile Maintenance feature from the Administrative Functions panel.

To access Explain Profile Maintenance

1. On the Main Menu, enter A on the command line.

Press Enter.

The Administrative Functions panel appears.

2. Enter 4 on the command line.

Press Enter.

The Explain Profile Maintenance panel appears.

Creating New Explain Profiles You can create explain profiles containing:

■ Defaults for the database options

■ Reports

■ Catalog statistics

■ SQL qualifiers

■ Search conditions

■ Access path filters

Chapter 19: Maintaining Explain Profiles 319

Page 320: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Creating New Explain Profiles

■ Search filters for explain processing

■ Optimization hints

The panels used in this process are similar to those used in Explain Strategy Services.

To create a new explain profile

1. On the Explain Profile Maintenance panel, enter the indicated values in the following fields:

■ CMD-Enter C.

■ Profile-Enter the name for the new explain profile.

■ Description-Type a description for the new explain profile.

■ SO-Indicate the share option for the new explain profile.

Press Enter.

The Explain Options panel appears.

2. Specify values for the fields on this panel.

Press Enter.

3. To update the database options, SQL qualifiers, access path filters, report selections, search conditions, catalog statistics, and search filters, perform the following:

■ Enter U next to the explain options to update.

■ Press Enter. The panel corresponding to one of the explain options you selected displays.

4. Modify the values on this panel.

5. Press Enter.

■ If you have selected more than one explain option to modify, the panel corresponding to the next explain option displays. Repeat this step for each panel.

■ If you have selected only one explain option to modify (or if the current panel corresponds to the last explain option to modify), the Explain Options panel appears.

6. Press Enter.

CA Plan Analyzer saves the profile values and returns you to the Explain Profile Maintenance panel.

320 User Guide

Page 321: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Filtering the Selection List

Filtering the Selection List Using the header fields, you can filter the selection list to contain only the explain profiles to browse, delete, or update.

To generate a selection list

1. On the Explain Profile Maintenance panel, enter the indicated values in the following fields:

■ Profile-Enter the name of the profiles to view or update.

■ Creator-Enter the creator ID of the profiles to view or update.

■ DB2 SSID-Indicate the ID of the DB2 subsystem on which the profiles are located.

Note: For the Profile and Creator fields, use wildcard characters to generate lists of all explain profiles that meet the criteria you specify.

2. Press Enter.

A list displays of all explain profiles that match the criteria you specified in the header fields.

Updating Existing Explain Profiles After you have specified options for an explain profile, you can modify them using the same series of panels.

To update an existing explain profile

1. On the Explain Profile Maintenance panel, enter U in the line command field next to the explain profile to update.

Press Enter.

The Explain Options panel appears.

2. Enter changes to the fields on this panel.

Press Enter.

3. To update the database options, SQL qualifiers, access path filters, report selections, search conditions, catalog statistics, and search filters, do the following:

h. Enter U next to the explain options to update.

i. Press Enter. The panel corresponding to one of the explain options you selected displays.

Chapter 19: Maintaining Explain Profiles 321

Page 322: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Browsing Existing Explain Profiles

4. Modify the values on this panel.

■ If you have selected more than one explain option to modify, the panel corresponding to the next explain option appears. Repeat this step for each panel.

■ If you have selected only one explain option to modify (or if the current panel corresponds to the last explain option to modify), the Explain Options panel appears.

5. Press Enter.

CA Plan Analyzer saves the profile values and returns you to the Explain Profile Maintenance panel.

Browsing Existing Explain Profiles The Explain Profile Maintenance facility browses explain profiles without updating them.

To browse an existing explain profile

1. On the Explain Profile Maintenance panel, enter B in the line command field next to the explain profile to browse.

2. Press Enter.

The Browse Explain Options panel appears.

3. To view database options, SQL qualifiers, access path filters, report selections, search conditions, catalog statistics, or search filters, do the following:

a. Enter B next to the explain options to view.

b. Press Enter. The corresponding panels for the options you selected display.

c. Press PF3 (End) to view the panel for the next option. After you press PF3 (End) from the panel that corresponds to the last option you selected, you are returned to the Browse Explain Options panel.

4. Press PF3 (End).

The Explain Profile Maintenance panel appears.

322 User Guide

Page 323: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting Explain Profiles

Chapter 19: Maintaining Explain Profiles 323

Deleting Explain Profiles The Explain Profile Maintenance facility can delete explain profiles that you no longer use.

On the Explain Profile Maintenance panel, enter D in the line command field next to the explain profile to delete and press Enter. CA Plan Analyzer deletes the explain profile and automatically updates the selection list.

Page 324: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 325: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Chapter 20: Maintaining the Plan Table

This section contains the following topics:

Accessing the Plan Table Maintenance Facility (see page 325) Filtering the Selection List (see page 326) Exploding a Plan Table to Plan/Package Detail Level (see page 326) Filtering the Plan Table Detail Selection List (see page 327) Deleting a Plan/Package (see page 328) Exploding a Plan Table to Query Detail Level (see page 328)

Accessing the Plan Table Maintenance Facility The Plan Table Maintenance facility helps you manage your optimization hints by giving you the ability to perform updates and deletes on the data in a specified plan table.

To access the Plan Table Maintenance facility

1. From the main menu, enter A in the command line.

2. Press Enter.

The Administrative Functions panel appears.

3. Enter 5 in the command line.

4. Press Enter.

The Plan Table Maintenance panel appears.

Chapter 20: Maintaining the Plan Table 325

Page 326: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Filtering the Selection List

Filtering the Selection List Using the header fields, you can filter the selection list to contain only the plan tables to update.

To filter the selection list

1. Access the Plan Table Maintenance panel.

2. Enter values in the header fields to specify filtering criteria.

You can use selection criteria. For more information about selection criteria, see the online help.

The following describes the header fields in which you enter criteria:

■ CREATOR-Indicate criteria for the owner ID of the plan table.

■ Location-Indicate the location name for a remote DB2 subsystem within which the plan table resides. The default is LOCAL.

■ To choose a DB2 location, enter a Question mark (?) or leave this field blank and press Enter. The CA-DB2 SSID/Location Selection panel appears, from which you can choose a location listing.

■ DB2 SSID-Indicate the DB2 subsystem ID within which the plan tables reside.

To choose a DB2 SSID, enter a Question mark (?) or leave this field blank and press Enter. The CA-DB2 SSID/Location Selection panel appears, from which you can choose a subsystem ID.

3. Press Enter.

The list of existing plan tables based on the criteria you specified is updated.

Exploding a Plan Table to Plan/Package Detail Level To explode a plan table

1. Access the Plan Table Maintenance panel.

2. Enter X in the line command field next to the plan table to explode.

3. Press Enter.

The Plan Table Detail panel appears.

326 User Guide

Page 327: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Filtering the Plan Table Detail Selection List

Filtering the Plan Table Detail Selection List Using the header fields, you can filter the selection list to contain only the plan or packages to update or delete.

To filter the selection list

1. Access the plan Table Detail panel.

2. Enter values in the header fields to specify filtering criteria.

You can use selection criteria. For more information about selection criteria, see the online help.

The following are header fields in which you can enter filtering criteria:

■ PLAN/COLLID-Indicate criteria for the plan or collection name.

■ DBRM/PKG-Indicate criteria for the DBRM or package name.

■ TYPE-Indicate whether to generate a list of plans, packages or both. Valid values are:

– *-Both plans and packages

– PK-Packages

– DB-Plans

■ ExplType-Indicate the type of SQL you want included, based on the method by which the SQL was explained. Valid values are:

– *-Both static and dynamic explained SQL

– DY-Dynamic explained SQL

– BD-Static explained SQL

– (Bound with EXPLAIN(YES))

3. Press Enter.

CA Plan Analyzer creates/updates a list of plans and packages based on the criteria you specified.

Chapter 20: Maintaining the Plan Table 327

Page 328: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Deleting a Plan/Package

Deleting a Plan/Package To delete a plan/package from the plan table

1. Access the Plan Table Maintenance facility.

2. Explode the plan table.

3. Enter D in the line command field next to the plan or package to delete.

Press Enter.

The Plan Table Detail panel appears.

Press Enter.

CA Plan Analyzer deletes the plan or package you selected and updates the list of plans and/or packages.

Exploding a Plan Table to Query Detail Level To explode a plan table to query detail level

1. Access the Plan Table Maintenance facility.

2. Explode the plan table.

3. Enter X in the line command field next to the plan or package to explode.

Press Enter.

The Plan Table Query Detail panel appears.

Line Commands for Queryno on the Plan Table Query Detail Panel

Access the Plan Table Query Detail panel. Then enter one of the following line commands next to the Queryno field:

ACC

(Short Access Report) This report is based on the current information displayed in the Plan Table Query Detail panel.

CMPO

(Compare Modified Access Path Report) This report is based on comparing the original access path to the modified access path and highlights any changes. If no changes have been made, a single Short Access Report displays.

328 User Guide

Page 329: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Exploding a Plan Table to Query Detail Level

D

(Delete) Enter D in the line command field next to the Queryno to delete and press Enter. D will display in the STATUS column next to every Qblockno/Planno in that Queryno.

Note: Deletes against your Plan Table are not completed until you press PF3 (End) to save the changes and exit the Plan Table Query Detail panel.

R

(Reset) Enter R in the line command field next to the Queryno to reset and press Enter. The STATUS column will be set to blank for all Plan Table rows within the Queryno and, if any of these plan table rows had a status of Update, then all updated fields will be reset to their original values.

Line Commands for Qblockno/Planno on the Plan Table Query Detail Panel

Access the Plan Table Query Detail panel. Then enter one of the following line commands next to the Qblockno/Planno:

D

(Delete) Enter D in the line command field next to the Qblockno/Planno to delete and press Enter. D will display in the STATUS column.

R

(Reset) Enter R in the line command field next to the Qblockno/Planno to delete and press Enter. The STATUS column will be set to blank and, if the value being reset was Update, then all the updated fields will be reset to their original values.

U

(Update)

To use the Update line command

1. Enter U in the line command field next to the Qblockno/Planno to update, and press Enter. The Plan Table Update Query Detail panel appears.

Chapter 20: Maintaining the Plan Table 329

Page 330: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Exploding a Plan Table to Query Detail Level

2. Modify the values on the Plan Table Update Query Detail panel and press Enter.

You can modify the following values:

Optimization Hint

Indicates that the row must be used for input to the DB2 optimizer by specifying a hint.

Primary Access

Indicates whether the direct row access will be attempted first. Valid values are:

■ D-Attempt to use direct row access.

■ Blank-Do not use direct row access.

Method

Indicate the join method or sort used for the step identified by Planno. Valid values are:

■ 0-ACCESS FIRST TABLE

■ 1-NESTED LOOP JOIN

■ 2-MERGE SCAN JOIN

■ 3-ADDITIONAL SORTS

■ 4-HYPRID JOIN

Table Creator

The authorization ID of the creator of the table.

Table Name

The name of the table.

Access Creator

The creator of the index used in an index scan. Can be left blank.

Access Name

The name of the index used in an index scan. Can be left blank.

Tabno

A number used to identify each reference to the same table within a single SQL statement.

Sortn Join

Indicate whether a new table was sorted for join methods (Merge Scan Join or Hybrid Join). Valid values are:

■ Y-Sort was performed.

■ N-Sort was not performed.

330 User Guide

Page 331: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Exploding a Plan Table to Query Detail Level

Page Range

Indicates whether the access path qualifies for page range paneling so that plans scan only the partitions that are needed. Valid values are:

■ Blank-Table does not qualify for page range paneling or is not partitioned.

■ Y-Table qualifies for page range paneling.

Sortc Join

Indicate whether a composite table was sorted for join methods (Nested Loop Join, Merge Scan Join, or Hybrid Join). Valid values are:

■ Y-Sort was performed.

■ N-Sort was not performed.

When Optimize

Indicates when the access path was determined. Valid values are:

■ Blank-This is the default. At Bind time, using a default filter factor for any host variables, parameter markers, or special registers.

■ B-Bind time

■ R-Run time

Prefetch

Indicates whether data pages were red in advance by prefetch. Valid values are:

■ S-SEQUENTIAL PREFETCH

■ L-PREFETCH THRU PAGE LIST

■ Blank-NO PREFETCH/UNKNOWN

Access Degree

The number of parallel I/O streams used on the new table. The value is null if access is not executed in parallel. The column contains 0 if there is a host variable. Valid values are:

■ *NULL-Represents a null value.

■ 0-32767

Access Pgroup

The ID of the parallel group. This ID is used when accessing the new table. Valid values are:

■ *NULL-Represents a null value.

■ 0-32767

Chapter 20: Maintaining the Plan Table 331

Page 332: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Exploding a Plan Table to Query Detail Level

332 User Guide

Join Degree

The number of parallel I/O streams used when joining the composite table with the new table. The value is null if access is not executed in parallel. The column contains 0 if there is a host variable. Valid values are:

■ *NULL-Represents a null value.

■ 0-32767

Join Pgroup

The ID of the parallel group. This ID is used when joining the composite table with the new table. Valid values are:

■ *NULL-Represents a null value.

■ 0-32767

Parallel Mode

Indicates the type of parallelism used at bind. Valid values are:

■ I-Query I/O parallelism

■ C-Query CP parallelism

■ X-Sysplex query parallelism

■ Dash (-) -Represents a null value. No parallelism occurred.

Correlation

The correlation name of a table or view that is specified in the statement. Valid values are:

■ *NULL-Represents a null value.

■ Correlation name

■ Press PF3 (End). The Table Query Detail panel appears with a value of “U” placed in the STATUS column.

■ Repeat these steps to update any other plan table rows.

Note: Updates/Deletes against your Plan Table are not completed until you press PF3 (End) to save the changes and exit the Plan Table Query Detail panel.

Primary Line Command for Plan Table Query Detail Panel

The primary line command for the Plan Table Query Detail panel is OPTHINT. It sets the optimization hint for a plan or package. It is an easy way to set all plan table rows in a plan or package to the same optimization hint.

Page 333: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Appendix A: Using Performance Data

This section contains the following topics:

Starting a CA Detector Collection (see page 333) Unloading Collection Data into a Sequential File (see page 333) Loading Performance Data (see page 335) Cards in the Sample Load JCL (see page 336)

Starting a CA Detector Collection This appendix describes how to obtain and load performance data.

The Performance Database Load Facility loads performance data from CA Detectorcollection information into a new table, PTI.PTAN_PRFM_#.

Note: To complete the steps described in this section, you must have a CA Detector license.

To obtain performance data, you must start CA Detectorcollection to capture the execution data, unload the CA Detector collection into a sorted sequential file, and load the data into the performance table of the PPA/POA shared database.

The following sections describe the steps for obtaining performance data.

Note: For more information, see the CA Detector User Guide.

Unloading Collection Data into a Sequential File Using the PDTDLOAD utility provided withCA Detector, you can unload collection data from the CA Detector VSAM collection data store into a sequential file.

Note: This section presents information from the CA Detector User Guide. The information has been modified for creating a sequential file from which you load performance data into the POA/PPA shared database.

Because CA Index Expert does not include an unload utility for this purpose, you must copy and modify the PDTDLOAD utility JCL provided with CA Detector.

This section describes the steps to unload the collection data.

Appendix A: Using Performance Data 333

Page 334: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Unloading Collection Data into a Sequential File

Copying PDTDLOAD

PDTDLOAD contains two job steps. The first step, called PDTULD, unloads the contents of the CA Detector VSAM data store into a single sequential file. The second step, called LOADUTIL, uses the DB2 load utility to load the data from the sequential file into CA Detector DB2 tables.

Because you do not load the data into DB2 tables, you must copy PDTDLOAD into a separate file in highlvl.SRCLIB and delete the LOADUTIL step. Then, modify the PDTULD step and execute the JCL. The following section describes the changes you must make.

Modifying the PDTULD Step

The following describes the changes you must make:

1. JOBNAME-Enter a valid JOB statement for your location.

2. STEPLIB DD-Specify the data set names of the installed CA Detector load libraries. You might also have to specify the DB2 load library if this library is not part of your linked list.

3. SYSOUT DD-Specify the data set into which to unload the CA Detector data store. The space allocation depends on the size of the data store. Use the size of the VSAM data store plus 10% to allow adequate spacing.

4. SSID-Specify the DB2 subsystem on which the data store was created.

5. DATASTORE-Specify the name of the data store to be unloaded.

6. VCAT-Specify the high level qualifier or VCAT of the data store data sets.

7. XMANID-Specify the XMANID of the Xmanager started task.

Note: When you are running multiple Xmanagers, use the XMANID for the version of CA Detector under which the data store was created.

After making these changes, execute the job. Continue with the Loading Performance Data section.

334 User Guide

Page 335: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Loading Performance Data

Sequential File Record Layout

Assembler macros describing the sequential file record layout of the unloaded file are provided in highlvl.SRCLIB. The following lists the macro members and their contents:

PDTESQL

SQL error collection data

PDTDYNR

Dynamic SQL collection data

PDTDYNT

Dynamic SQL collection SQL call text

PDTSTAN

Standard collection data

Loading Performance Data Provided with CA Index Expert is a sample JCL file that you can modify to use with the Performance Database Load facility. You can find this JCL in highlvl.SRCLIB(PPAPRFML).

The following steps describes the changes you must make to the JCL.

1. Enter JOB statement parameters that reflect the requirements for your site.

2. In the STEPLIB, PTILIB, and PTIPARM DD statements, replace highlvl. with the high-level qualifier for your site.

3. Replace PPA.DATASTOR.UNLOAD with the fully qualified name of the CA Detector flat file that you unloaded from the data store.

4. Replace SSIDT with the SSID of the target CA Plan Analyzer subsystem on which to load the performance data.

5. Replace SSIDS with the SSID of the source subsystem of the CA Detector collection.

Appendix A: Using Performance Data 335

Page 336: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Cards in the Sample Load JCL

Cards in the Sample Load JCL The Performance Database Load Facility uses the cards shown in the following illustration:

DATASTORE = (PPA.DATASTOR.UNLOAD) TARGET = (SSIDT,LOCAL) SOURCE = (SSIDS,LOCAL) RESTART = (value) LOCK = (Y) MSGSLEVEL = (INFO) INCLUDE = (type, source type, plan/collid, DBRM/pack, package version) EXCLUDE = (type, source type, plan/collid, DBRM/pack, package version)

The following describes these cards. Be sure to enclose all values in parentheses. Unless otherwise noted, all cards are required.

DATASTORE = (data set name)

Indicate the data set name of the CA Detector data store that you unloaded.

TARGET = (ssid,location)

Indicate the ID and location of the subsystem to which to write the performance data.

SOURCE = (ssid,location)

Indicate the ID and location of the subsystem on which the unloaded data resides.

RESTART = (value)

(Optional) Indicate what the Load facility must do if a failure occurs. When you use this card, the load facility repositions itself at the record where processing ended. The valid value is numeric-Return the numeric value to the load output report.

LOCK = (value)

■ Determines whether the CA Plan Analyzer database is locked while loading. Valid values are:

■ Y-Lock the database. This improves the performance of the utility.

■ N-This is the default. Do not lock the database, leaving it available to other jobs/users.

Note: This card cannot be omitted.

336 User Guide

Page 337: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Cards in the Sample Load JCL

MSGSLEVEL = (value)

Determines the level of error reporting generated during the database load. Valid values are:

■ INFO-Informational. Information is reported for all statements that are loaded successfully or unsuccessfully.

■ WARN-Warnings. Warnings and errors are listed in the report; provides less detail than the I (Information) option.

■ ERROR-This is the default. Errors. Only errors are reported in the Load Utility Report; less detail than in the W (Warnings) option.

INCLUDE = (type, source type, plan/collid, DBRM/pack, package version)

Indicate the data to include in the load. All parameters are described in the following table.

Note: You must have at least one INCLUDE card. You can use more than one INCLUDE within a single execution of the load JCL. EXCLUDE statements take precedence over INCLUDE statements.

EXCLUDE = (type, source type, plan/collid, DBRM/pack, package version)

(Optional) Indicate the data to exclude from the load. All parameters are described in the table that follows.

Note: You can use more than one EXCLUDE within a single execution of the load JCL. EXCLUDE statements take precedence over INCLUDE statements.

The following list describes the parameters required for the INCLUDE and EXCLUDE cards:

type

Indicate the SQL type. Valid values are:

■ DYNAMIC-The SQL is dynamic.

■ STATIC-The SQL is static.

source type

Indicate whether the source is a plan or package. Valid values are:

■ PLAN-Source is a plan.

■ PACK-Source is a package.

plan/collid

Indicate the name of the plan or collection ID. You can use wildcards to select groups of plans or collection IDs.

Appendix A: Using Performance Data 337

Page 338: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Cards in the Sample Load JCL

338 User Guide

DBRM/pack

Indicate the name of the DBRM or package. You can use wildcards to select groups of plans or collection IDs.

package version

Indicate the name of the package version.

Page 339: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Appendix B: Performance Recommendations

This section contains the following topics:

Avoid the DB2 System Catalog (see page 339) Reduce the Analysis Request (see page 341) Reduce the Amount of SQL Analyzed (see page 343)

Avoid the DB2 System Catalog This appendix offers recommendations for using the Enhanced Explain facility of CA Plan Analyzer to improve your application performance. The dynamic Enhanced Explain facility offers in-depth analysis and flexibility. For example, the Enhanced Explain facility can produce an Access Path report on a specified plan. On a more complex scale, the facility performs an EXPLAIN using many differing SQL sources, plans, packages, DBRMs, QMF queries, and SPUFI queries while producing up to 10 different reports and applying the Expert System Rules. Other options let you target the most expensive SQL, SQL that contains a certain string value, and SQL that contains a specific clause or type of predicate.

There are three main guidelines to follow when running the Enhanced Explain.

■ Avoid the DB2 System Catalog.

■ Do not ask for unnecessary analysis.

■ Analyze only the SQL that needs to be analyzed.

Note: You can also improve performance by creating an additional index on the SYSDBRM, SYSFIELDS, and SYSSTMT DB2 catalog tables. For more information, see the Implementation Guide.

The Enhanced Explain facility uses information in the DB2 System Catalog to perform an Enhanced Explain analysis. Many performance problems can be attributed to the DB2 System Catalog, especially when the user's DB2 environment is large.

Appendix B: Performance Recommendations 339

Page 340: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Avoid the DB2 System Catalog

The IBM DB2 System Catalog was designed for the internal use of DB2. Therefore, the System Catalog has its own internal, proprietary methods that use link pointers to access the data in an efficient (but not relational) manner. These internal methods were not designed for extensive and complex analysis queries outside DB2. For example, many tables defined in the System Catalog do not have any indexes on them. Any query to these tables automatically uses a tablespace scan, which is the most inefficient access path possible. Compounding the problem, all tablespaces used by CA Plan Analyzer have multiple tables in the tablespace catalog. This means that DB2 reads all pages in the tablespace to find the data from the table in the query. The result is inefficient access to these tables.

Use Alternate Catalog Mapping (ACM)

The use of ACM provides the greatest performance improvement of all items listed in this appendix. ACM avoids the DB2 System Catalog almost completely. The exception is when a Future type Explain is requested. This type of Explain uses the native dynamic EXPLAIN command, which accesses the System Catalog tables. The additional indexes contained in member PPAACMIX are tuned to make the catalog access as fast as possible. The use of ACM can make the Enhanced Explain run up to 2-6 times faster than without ACM.

Note: For more information, see the Value Pack Reference Guide.

Recommendation Indexes for DB2 Catalog Tables

For more information, see the chapter "Operational Considerations."

Use SRCDBRML Input

The use of SRCCAT, which explains SQL in application plans defined in the catalog, requires CA Plan Analyzer to perform a tablespace scan of SYSSTMT for each SRCCAT card. Instead, use the SRCDBRML input for the Enhanced Explain so that CA Plan Analyzer reads DBRMs from the DBRM library.

Use as Few SRCCAT Cards as Possible

Each SRCCAT card causes a tablespace scan on SYSSTMT. If you must access SYSSTMT, try to use a plan name mask to explain a group of liked-named plans with one SRCCAT card. For example if your plan names are PPAM0100, PPAM0101, PPAM0102, PPAM0103, and PPAM0104, use the mask PPAM010% to retrieve and explain all the SQL in these plans with one SRCCAT card.

340 User Guide

Page 341: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reduce the Analysis Request

Reduce the Analysis Request The second performance guideline is reducing the amount of analysis you request. For example, do not request some of the more complex analysis as a normal part your everyday usage of the Enhanced Explain.

Every requested analysis has its price. This price could come in I/O, CPU time, catalog contention, or wall-clock time. More than 75% of the resources used occur in gathering data from DB2 to perform the Enhanced Explain analysis.

To improve performance, you must avoid accessing the SYSSTMT table and reduce the amount of data retrieved from non-indexed catalog tables in SYSDBASE. These tables are:

■ SYSTABLEPART

■ SYSFIELDS

■ SYSINDEXPART

■ SYSVIEWS

■ SYSKEYS

■ SYSRELS

This section highlights the Enhanced Explain reports and options that cause these tables to be accessed. By not asking for the analysis performed by these reports or options, you can greatly reduce the amount of resources needed. Other catalog tables are accessed, but these tables have indexes that are used by the CA Plan Analyzer analysis, and as such, do not consume great amounts of resources.

Note: For the SQLRULE and PHYSRULE reports, you must omit the report, or select the report but deactivate the listed rules in the rule set that you are using. For more information, see the CA Plan Analyzer Reference Guide.

SYSTABLEPART

Reports and options that cause CA Plan Analyzer to access SYSTABLEPART are:

■ STATISTICS report

■ PHYSRULE report (short or long)

Rule 1004 Rule 1017 Rule 1045

Rule 1016 Rule 1044 Rule 1015

Rule 1043 Rule 1014 Rule 1042

Rule 1013 Rule 1018

Appendix B: Performance Recommendations 341

Page 342: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reduce the Analysis Request

SYSINDEXPART

Reports and options that cause CA Plan Analyzer to access SYSINDEXPART are:

■ TREE report

■ STATISTICS report

■ PHYSRULE report (short or long)

Rule 1033 Rule 1051 Rule 1050

Rule 1049 Rule 1034 Rule 1052

SYSKEYS

Reports and options that cause CA Plan Analyzer to access SYSKEYS are:

■ DEPENDENCY report (Long format only)

■ TREE report

■ PHYSRULE report (short or long)

Rule 1010 Rule 103151 Rule 1026

Rule 1025 Rule 1011 Rule 1032

SYSFIELDS

Reports and options that cause CA Plan Analyzer to access SYSFIELDS are:

■ SQLRULE report (short or long)-Rule 0062

SYSVIEWS

Reports and options that cause CA Plan Analyzer to access SYSVIEWS are:

■ Process Views Options = Y (in the Global Explain Options)

Note: Turning this option off (=N) causes CA Plan Analyzer to not process references to views as it normally would. Some analysis, such as analysis of predicates defined in the view, could be incomplete because of this.

342 User Guide

Page 343: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reduce the Amount of SQL Analyzed

SYSRELS

The TREE report causes CA Plan Analyzer to access SYSRELS.

Reduce the Amount of SQL Analyzed The third guideline is to reduce the amount of SQL analyzed. The Enhanced Explain provides four types of filters that can help you target the Enhanced Explain analysis to that SQL that concerns you the most. This section describes the filters that help improve the SQL optimization.

Cost Filter

The Cost filter (with the COST report) filters out any SQL that does not exceed the cost filter you establish. Only those statements that exceed this filter are further analyzed by the Enhanced Explain.

Note: For more information, see the CA Plan Analyzer Reference Guide.

Search Condition

The Search Condition targets those SQL statements that have a specific SQL syntax, such as SQL statements that have non-indexable, non-sargable (non-Stage 1) predicates, SQL statements with subqueries, or SQL statements with column or scalar functions. You can use AND and OR together to form complex conditions. Only those SQL statements that contain the search conditions are explained and further analyzed by the Enhanced Explain. For more information, see the chapter “Using Quick Explain and Explain Strategy Services.”

Search Filter

The Search filter searches for a specific character string, such as a table or column name. Only those SQL statements that contain the specified strings are explained and further analyzed by the Enhanced Explain. For more information, see the chapter “Using Quick Explain and Explain Strategy Services.”

Appendix B: Performance Recommendations 343

Page 344: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reduce the Amount of SQL Analyzed

344 User Guide

Access Path Filter

The Access Path filter limits the SQL explained to statements that match certain access methods. For example, you can request to explain only those statements that contain LOCKS, tablespace scans, or non-matching indexes. For more information, see the chapter “Using Quick Explain and Explain Strategy Services.”

Page 345: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Appendix C: Quick Steps

This section contains the following topics:

Setup Procedures (see page 345) Profile Variables (see page 348) Explain Strategy Services (see page 348) Identifying SQL and Object Problems (see page 365) Generating Object Reports (see page 369) Altering the Object (see page 372) Correcting Plan Problems (see page 373) Reexplaining a Strategy (see page 376)

Setup Procedures This appendix presents introductory information about most of the CA Plan Analyzer facilities as a tutorial. Review the individual component chapters for detailed information. Also, you can access online help at any time for field descriptions, options, and suggestions by pressing PF1 (Help).

This appendix describes how to quickly:

■ Set up the tutorial.

■ Create and explain a strategy.

■ Identify SQL and object problems.

■ Correct plan problems.

This section contains the necessary steps that the system installer and user must complete before running the tutorials.

Note: Only one user at a time must execute the tutorial because the tutorial involves manipulating one set of demo objects.

The following lists each tutorial data set and its purpose:

'highlvl.SRCLIB(PPADEMOS)'

Executed by the installer. Creates the stogroups, databases, tables, tablespaces, and indexes used in the tutorials.

'highlvl.SRCLIB(PPADEMO)'

Executed by the user before beginning the tutorials. Resets the object values that might have been changed by the last tutorial user.

Appendix C: Quick Steps 345

Page 346: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Setup Procedures

'highlvl.SRCLIB(PPADEMOB)'

Executed by the user before beginning the tutorials. Contains the JCL to bind the demo plan. (Tailored on site by the installer.)

'highlvl.SRCLIB(PPADEMOA)'

Executed by the user later in the tutorials. Contains the JCL necessary to alter a demo table's column attributes and to drop and recreate the dependent objects. (Tailored on site by the installer.)

Steps for the Installer

This section contains the steps the system installer must complete.

Create the Demo Objects

The tutorials access demo databases, tablespaces, and tables. Create these objects using the DDL included on the product tape. Users can execute the tutorials in their entirety after you execute this DDL.

You only need to create the demo objects once.

To create the demo objects, execute 'highlvl.SRCLIB(PPADEMOS)'. For example, you can execute this data set under SPUFI.

Modify the Bind Job for the User

PPADEMO drops and recreates the demo objects. When PPADEMO is submitted by the tutorial user, it invalidates the demo plan associated with the dropped and recreated objects. Therefore, a bind is required to validate the demo plan. To execute PPADEMO, tutorial users require SYSADM authority or must be associated with the RACF group PTI.

Member PPADEMOB contains the JCL to bind the demo plan.

Tailor the batch job within PPADEMOB to your site. Instructions are included within the job. PPADEMOB resides in 'highlvl.SRCLIB'.

Note: You do not need to execute the bind because the tutorial user submits 'highlvl.SRCLIB(PPADEMOB)' before beginning the tutorials.

346 User Guide

Page 347: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Setup Procedures

Modify PPADEMOA for the User

PPADEMOA contains the job necessary to alter a demo table's column attributes and to drop and recreate the dependent objects.

Tailor the batch job within PPADEMOA to your site. Instructions are included within the job. PPADEMOA resides in 'highlvl.SRCLIB'.

Note: You do not need to execute the job because the tutorial user submits 'highlvl.SRCLIB(PPADEMOA)' later during the tutorials.

Steps for the Tutorial User

This section contains the steps the tutorial user must complete before beginning the tutorial.

Confirm the Creation of Demo Objects

CA Plan Analyzer references demo objects for this tutorial. Confirm that your system installer has created the demo objects before you begin the tutorial.

Reset the Demo Object Statistics

During the tutorials, you alter a demo object and update the demo object's statistics. The user who last executed the tutorials made changes, so you must restore the altered object and its values to their original state. PPADEMO is supplied for this task.

PPADEMO drops any changed tables, recreates the dropped tables to their original state, and recreates the tables' corresponding indexes.

Execute data set 'highlvl.SRCLIB(PPADEMO)' to help ensure that you are starting with the original tutorial object values. For example, you might want to execute the data set under SPUFI.

Note: If you do not execute PPADEMO, the tutorials do not work. Only users with SYSADM authority can successfully execute PPADEMO. If you are unable to execute PPADEMO, ask your system administrator to add your ID to the secondary authid group PTI. This is done through RACF Group Profile Services.

Submit the Bind Member

The demo plan is invalidated when PPADEMO is executed. A bind validates the plan.

PPADEMOB contains the job necessary to bind the demo plan. This member must have been modified for your site by your system installer. Confirm with your system installer that PPADEMOB has been tailored for your site.

Appendix C: Quick Steps 347

Page 348: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Profile Variables

Submit data set 'highlvl.SRCLIB(PPADEMOB)' for batch processing.

Note: Binding the demo plan is an optional step. However, to illustrate the validity of the plan throughout the tutorials, it is recommended that you bind the demo plans.

Profile Variables This section describes how to set options specific to CA Plan Analyzer. You must change two of these default values for this tutorial exercise.

Accessing the Profile Variables

To access the profile variables

1. On the Main Menu, select P (Profile).

Press Enter.

The Profile Menu panel appears.

2. Enter 2 in the Option field.

Press Enter.

The Profile Variables panel appears.

Changing the Default Values

To change the default values from the Profile Variables panel

1. In the Strategy List Mode default field, enter L.

This lists a strategy's versions on the Explain Strategy Services panel.

2. In the Expert Mode default field, enter Y.

This uses Expert mode for enhanced explain processing.

3. Press PF3 (End) to save the changes and return to the Profile Menu.

4. Press PF3 (End) again to return to the Main Menu.

Explain Strategy Services This section describes how to create and explain a strategy.

348 User Guide

Page 349: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Accessing the Explain Strategy Services

To access the explain strategy services option on the Main Menu, select 2 (EXPLAIN Strategy Services), and press Enter. The Explain Strategy Services panel appears.

Creating a Strategy

To create a strategy from the Explain Strategy Services panel

1. Complete the fields for the strategy creation row:

■ In the CMD field, enter C.

■ In the Strategy/Version field, enter SCENARIO.

■ In the Description field, enter EXAMPLE SCENARIO STRATEGY.

Press Enter.

The Explain Strategy Data Editor panel appears.

Creating an SQL Source Definition

To create an SQL input source

1. Complete the fields for the creation row:

■ In the C field, enter C.

■ In the TY field, accept the default (A). This automatically builds the SQL source from the selection criteria you entered in the Plan/Collid and DBRM/Pkg fields.

■ In the Target SSID field, enter the ID of the DB2 subsystem where you want the SQL source explained.

■ In the OP field, enter Y. This field specifies options for enhanced explain processing.

■ In the SSID field, enter the ID of the DB2 subsystem where the SQL source resides.

■ In the Plan/Collid field, enter PPASCEN1. This specifies the plan to use in the explain.

■ In the DBRM/Pkg field, enter PPA@SCE%. The use of the wildcard character includes all the DBRMs in the specified plan that begin with PPA@SCE.

■ Leave the STMT field blank. This explains all SQL in PPASCEN1.

Appendix C: Quick Steps 349

Page 350: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

2. Press Enter to process your selections.

3. In the command line, enter OPTIONS.

Press Enter.

The Explain Strategy Explain Options panel appears.

Selecting Source Option Types

To select source options from the Explain Strategy-SOURCE OPTIONS panel

1. In the Database Options field, enter Y.

This field selects options for the historical database.

2. In the Reports field, enter Y.

This field selects the reports to generate during the explain.

3. Press Enter.

The Historical Database Options panel appears.

Specifying Historical Database Options

To select options for hversion generation

1. In the Save Historic Data as a Strategy field, enter Y.

This creates a strategy historical update to the database.

2. In the Update CURRENT HVersion field, enter N.

3. In the Create New HVersion field, enter N.

4. Press Enter.

The Explain Strategy Reports panel appears.

350 User Guide

Page 351: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Selecting Reports for Generation

On the Explain Strategy Reports panel, select the reports to generate during the explain. You must select at least one report to generate and save enhanced explain output.

To select reports for generation

1. Complete the fields as follows:

■ Enter Y in the following fields:

– Summary

– Cost

– Predicate

■ Enter L in the following fields:

– Access

– Dependency

– SQLRULE

2. Press Enter to process your selections.

The Source Options panel appears.

3. Press PF3 (End) to quit defining options.

The Explain Strategy Data Editor panel appears.

Saving the Strategy

To save the strategy from the Explain Strategy Data Editor panel, press PF3 (End). The Explain Strategy Services panel appears with a message indicating that the strategy has been saved.

Explaining the Strategy

This section describes how to explain a strategy.

Using the Explain Line Command

On the Explain Strategy Services panel, enter E in the CMD field next to the strategy you created, and press Enter. The Explain Strategy Version Info panel appears.

Note: The list of line commands also shows the C (create) line command, which is only valid when creating a new strategy.

Appendix C: Quick Steps 351

Page 352: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Specifying Version Information

To specify version information

1. In the Identifier field, enter VERS1.

This is the name of the version.

2. In the Description field, enter EXAMPLE VERSION 1.

This is a brief description of the version.

3. In the Replace Existing Version field, accept the default (N).

This indicates that the version you are creating does not replace any existing version with the same name.

4. In the Update Explain Options field, accept the default (Y).

This field specifies explain options.

5. Press Enter.

The Explain Options panel appears.

Specifying Explain Options

To specify explain options

1. In the Rule Set SSID field, enter the ID of the DB2 subsystem that contains the customized rule set for your site.

2. In the Target SSID field, enter your DB2 subsystem ID.

This performs the explain on your subsystem.

3. Note the effects of accepting the default values in the following fields:

■ PLAN_TABLE Option-The default (R) executes a DB2 EXPLAIN for the SQL within the strategy. The results are added to the PLAN_TABLE that is owned by the current authorization ID of the process, but these results are not saved into the PLAN_TABLE. Instead, the results are saved as enhanced explain output in the historical database.

■ Explain Type-The default (F) requests a future type explain. This type of explain uses the information from the DB2 Optimizer after executing a dynamic EXPLAIN command, and catalog statistics and CA Plan Analyzer Expert System Rules. Future type explains indicate what the access paths would be if you were to request a bind right now.

■ Reports-The default (Y) generates the reports selected on the Explain Strategy Reports panel. For more information, see Selecting Reports for Generation.

■ Save Reports-The default (Y) saves the generated reports.

4. Press Enter.

The Batch Processor Card Display panel appears.

352 User Guide

Page 353: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Executing the Explain

The Batch Processor Card Display panel displays the SQL statements and Batch Processor commands required to execute the explain. The information within the .DATA section contains information about what batch input to use as source input and what type of reports to generate.

Note: For more information, see the Batch Processor Reference Guide.

Use PF7 (Up) and PF8 (Down) to scroll through the entire input.

To execute the explain

1. Press Enter.

The batch input is submitted.

Depending on the value specified for your PPA PARMLIB, the Resource Use Online panel might appear. At the site, the PARMLIB was set to W (Warning) to request this panel.

If your site does not request the Resource Use Online panel, then the Batch Processor In-Progress panel appears.

2. If the Resource Use Online panel appears, press Enter to continue processing.

The Batch Processor In-Progress panel appears.

After your explain executes, the Audit Message File panel appears.

Appendix C: Quick Steps 353

Page 354: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Viewing the Results

After commands are executed in online mode, The Audit Message File panel appears. This panel displays the results of your explain and each Batch Processor command.

BPPAUDT ----------- AUDIT Message File ----------- COMMAND ===> find 'summary report' SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx .LIST TERM RETCODE = 0 .CONNECT D71A RETCODE = 0 .OPTION NOERRORS RETCODE = 0 .CALL EXPLAIN .DATA RULESSID = (D71A) ACM = (N,SYSIBM) STRATEGY = (D71A,SCENARIO,PDGLS,VERS1) PLANTAB = (ROLLBACK) SQLQUAL = (PDGLS) CURPATH = () CASE = (UPPER) LINES = (55) PROCDDF = (Y) FLOATFMT = (ENG) SAVEHOST = (Y) PROCVIEW = (Y) EXPLTYPE = (FUTURE) ISOLATE = (CS) TARGET = (D71A(@DEFAULT)) PERFTIE = (Y) DATABASE = (STRATEGY) REPORT = (SUMMARY,COST,ACCESS,PREDICATE,DEPENDENCY,SQLRULE) SRCCAT = (D71A,LOCAL,PPASCEN1,PPA@SCE%,,) .ENDDATA

The Batch Processor command section is always executed first. These commands are:

.LIST TERM

Lists the output to the terminal.

.CONNECT

Connects to the DB2 subsystem.

.OPTION NOERRORS

Performs a rollback if an error is encountered during execution.

354 User Guide

Page 355: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Locating the First Report

Rather than using PF8 (Down), use the FIND command to locate the first report, which is the Summary Report.

To locate the first report, enter FIND 'SUMMARY REPORT' in the command line, and press Enter. The Summary Report appears.

Interpreting Enhanced Explain Reports

The DB2 EXPLAIN output is translated into concise, easy-to-read reports. These reports are called enhanced explain reports.

Note: For more information, see the CA Plan Analyzer Reference Guide.

Summary Reports

The Summary report provides a quick overview of the results of the explain process. This report is useful to check what SQL has been processed and whether the SQL was explained successfully.

PPA Vxxx --------- Plan Analyzer Enhanced Explain ------------- Page 2 DATE YY/MM/DD Summary Report TIME HH:MM EXPLAIN PAGE PLAN/COLLECTION DBRM/PKG PACK VERS STMT NUM TYPE SQLCODE NUMBER ------------------ -------- -------------- ---------- ---- ------- ------ *TESTNEWV9 ........,V9NEWEXM, ............., 21,SEL , +0 3 *TESTNEWV9 ........,V9NEWEXM, ............., 34,SEL , +0 4 *TESTNEWV9 ........,V9NEWEXM, ............., 47,SEL , +0 5 *TESTNEWV9 ........,V9NEWEXM, ............., 67,SEL , +0 6 *TESTNEWV9 ........,V9NEWEXM, ............., 73,SEL , +0 7 *TESTNEWV9 ........,V9NEWEXM, ............., 79,SEL , +0 8 *TESTNEWV9 ........,V9NEWEXM, ............., 88,SEL , +0 9 *TESTNEWV9 ........,V9NEWEXM, ............., 109,MRG , +0 10 *TESTNEWV9 ........,V9NEWEXM, ............., 126,MRG , +0 11 *TESTNEWV9 ........,V9NEWEXM, ............., 140,SEL , +0 12 Target DB2 SSID: DBV9 The Most Severe SQLCODE: +0 Source DB2 SSID: DBV9 Total Number of Selects: 8 Collection: TESTNEWV9 Updates: 0 Package : V9NEWEXM Inserts: 0 Stmt : Deletes: 0 : Merges : 2

Appendix C: Quick Steps 355

Page 356: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

The following is a brief description of the fields in the Summary report. All the fields are display only.

PLAN/COLLECTION

The name of the plan or collection, when the plan or collection is the explain source. In this example, plan PPASCEN1 was explained.

DBRM/PKG

The DBRM or package associated with the plan or collection.

PACK VERS

(For packages only) The version identifier of the package, if a version was specified at precompilation time.

STMT NUM

Numeric identifiers of the SQL statements explained. Statement numbers are listed in ascending order within each DBRM that was explained.

If the SQL being explained comes from a DB2 catalog as part of a plan or package, these are the actual statement numbers assigned by the DB2 precompiler. Otherwise, ascending numbers are assigned based on the order that the SQL is processed.

TYPE

The type of SQL statement. The types of SQL statements that are eligible for the EXPLAIN process are SELECT, UPDATE, INSERT, DELETE, and MERGE.

EXPLAIN SQLCODE

Shows the actual SQL code that is returned from the explain process.

■ A return code of +0 indicates a successful execution.

■ If the SQL code is non-zero, there could be a problem with the syntax of the SQL statement, the definition of the underlying objects, or the specification of the Primary AUTH or Secondary AUTH option fields.

PAGE NUMBER

The page number where the SQL statement is located in the Statement Explain Detail report.

356 User Guide

Page 357: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

STATEMENT SUMMARY

A brief synopsis of the SQL source SSID, plan, DBRM, and statement selected for the explain.

■ Target DB2 SSID-The DB2 subsystem where the SQL is actually explained.

■ Source DB2 SSID-The DB2 subsystem where the SQL source resides.

■ Source Information-The source plan, DBRM, and statement selected for the EXPLAIN.

■ The Most Severe SQLCODE-Displays the most severe SQL code encountered. Check this field first to determine whether any of the explained SQL resulted in a non-zero SQL code.

■ Total Number of Selects-Lists how many SELECT, UPDATE, INSERT, and DELETE statements were explained for this SQL source.

Locating the First Explain Detail Section

In the command line, enter FIND 'DETAIL REPORTS', and press Enter.

According to the Summary report, STMT# 9 must be the first displayed statement. The cursor is positioned within the Explain Detail section for STMT# 9 and a STRING FOUND message is displayed.

Appendix C: Quick Steps 357

Page 358: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Explain Detail Information

Detailed information about each explained statement is presented in a section called SQL Statement Detail Reports. Other than Summary and Cost reports, this section appears as a heading for each explained SQL statement's report.

BPPAUDT ----------- AUDIT Message File ----------- COMMAND ===> SCROLL ==> CSR PT022I - STRING FOUND ------------------------------------------------------------- USER ID: xxxxxx DATE 02/12/03 SQL STATEMENT DETAIL REPORTS TIME 16:39 SOURCE DB2 SSID: D71A DATE/TIME: 02/12/03, 16:39:03:52 PLAN: PPASCEN1 DB2 SSID : D71A DBRM: PPA@SCE1 SQL CODE : +0 STMT: 9 MESSAGE : HINT USED : N/A SQL STATEMENT TEXT: DECLARE CURSOR_2 CURSOR FOR SELECT A.COL1 , A.COL2 , A.COL4 FROM PTI.VDEMO_SCENARIO2 A WHERE A.COL2 BETWEEN :HOST_LOW AND :HOST_HIGH DEPENDENT VIEW TEXT: CREATE VIEW PTI.VDEMO_SCENARIO2 AS SELECT ALL COL1 , COL2 , COL4 FROM PTI.DEMO_SCENARIO2 WHERE COL4 = 'AUTOMOBILE' ACCESS PATH ANALYSIS: THIS ACCESS PATH CONSISTS OF 1 QUERY BLOCK(S). QUERY BLOCK 1 HAS 1 STEP(S). +--- QUERY BLOCK: 1 I I THIS QUERY BLOCK CONSISTS OF 1 STEP(S). I I THIS QUERY BLOCK SQL OPERATION IS: SELECT I I I +--- PLAN STEP: 1 PF7/8: Scroll Up/Down PF3/15: End

358 User Guide

Page 359: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

The information is arranged in three sections:

Source Information

The top of the report summarizes the source information.

SQL Statement Text

Displays each SQL statement's text as the first part of the Explain Detail section.

Dependent View Text

Displays the CREATE VIEW text for all dependent views if the SQL is dependent on views and the Dependency report has been selected. If no views are referenced, this section does not display.

Press PF8 (Down) until you find page 7, which displays information about the next statement (STMT 2).

BPPAUDT ----------- AUDIT Message File ----------- COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx DATE 02/12/03 SQL STATEMENT DETAIL REPORTS TIME 16:39 SOURCE DB2 SSID: D71A DATE/TIME: 02/12/03, 16:39:03:94 PLAN: PPASCEN1 DB2 SSID : D71A DBRM: PPA@SCE2 SQL CODE : +0 STMT: 2 MESSAGE : HINT USED : N/A SQL STATEMENT TEXT: DECLARE CURSOR_1 CURSOR FOR SELECT B.COL1 , B.COL2 , B.COL3 , A.COL4 FROM PTI.DEMO_SCENARIO1 A , PTI.DEMO_SCENARIO2 B WHERE A.COL2 = B.COL2 AND A.COL4 = 'BOLT'

Use PF8 (Down) to review the Access report for statement 2.

Access Report

The Access report shows you how DB2 retrieves the data from the tables it accesses and estimates how expensive the SQL is to execute.

Appendix C: Quick Steps 359

Page 360: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

The estimated CPU processor cost in milliseconds, service units, and relative cost (CPU processor cost plus I/O utilization) format is displayed prior to the access path query blocks and plan steps.

■ Query Blocks-First, DB2 breaks the SQL statement into its component subquery clauses. For each of these subqueries, DB2 constructs a query block that maps how to access the data to satisfy that subquery.

■ Plan Steps-Next, DB2 breaks each subquery down into component parts for each table that subquery accesses. DB2 constructs a plan step for each table that is accessed within the query block.

An SQL statement has as many query blocks as there are subquery clauses, and each query block has at least as many plan steps as the number of tables that are accessed by the associated subquery clause.

The Access report contains the following sections:

Access Summary

The top of the report summarizes how expensive the SQL is and displays the number of query blocks and plan steps within each block needed to execute the SQL. The estimated CPU processor cost in milliseconds, service units, and relative cost (CPU processor cost plus I/O utilization) format is displayed prior to the access path query blocks and steps.

Query Block

The query block contains the plan step(s) and begins with Query Block: 1 and ends with Query Block: 1 END.

Plan Step

DB2 EXPLAIN output is translated into complete paragraphs for the Access report. This information is presented in the plan step areas. The plan step areas consist of the space from Plan Step: 1 to Plan Step: 1 END and from Plan Step: 2 to Plan Step: 2 END.

The Access report indicates that the optimizer is not fully utilizing the existing indexes, DEMO_SCENARIO1_IX and DEMO_SCENARIO2_IX, to access the data from DEMO_SCENARIO1 and DEMO_SCENARIO2.

Press PF8 (Down) to scroll past the end of the last query block to review the Dependency report.

SQL Dependency Analysis Report

The Dependency report displays each object the SQL statement references in a seven-level hierarchical format. Each object or group of objects is indented, and each object is listed on an individual row.

360 User Guide

Page 361: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Use PF7 (Up) or PF8 (Down) to scroll through the report.

SQL DEPENDENCY ANALYSIS: TABLESPACE L NACTIVE NTBL PGSZ SIZE TABLE/ALIAS/VIEW/SYNM EV CARD NPAGES PCTPG PCTRC INDEX UP 1ST/FULL NLEAF NLVL CLUST TRIGGER TIME EVENT GRAN COLUMN NP COLCARD LENGTH COLNO COLSQ DISTINCT-TYPE IDENTITY TYPE CACHE CYCLE ORDER ------------------------------- -------- -- ---------- ---------- ----- ----- PTIDEMO.PTIDEMO SEGMENT A 21780 2 4 4 PTI.DEMO_SCENARIO1 TABLE E 6592 1101 5 0 ** TABLE COLUMNS ** COL1 CHAR 30 15 COL2 * VARCHAR 30 20 COL3 CHAR 30 15 COL4 * CHAR 30 15 COL5 CHAR 30 15 PTI.DEMO_SCENARIO1_IX TYPE-2 D 30 33 2 81 (NON-UNIQUE) 10000 COL2 ASC 2 1 COL4 ASC 4 2 PTI.DEMO_SCENARIO2 TABLE E 6592 1101 5 0 ** TABLE COLUMNS ** COL1 * CHAR 30 15 COL2 * CHAR 30 15 COL3 * CHAR 30 15 COL4 CHAR 30 15 COL5 CHAR 30 15 PTI.DEMO_SCENARIO2_IX TYPE-2 D 30 33 2 81 (NON-UNIQUE) 10000 COL2 ASC 2 1 COL4 ASC 4 2

This report shows that DEMO_SCENARIO1 has index DEMO_SCENARIO1_1X, with columns referenced by COL2 and COL4. To see how the SQL is accessed, and whether the SQL is using the indexes, press PF8 (Down) to scroll to the next report, Predicate Analysis.

Appendix C: Quick Steps 361

Page 362: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

Predicate Analysis

A predicate is a portion of a WHERE clause that describes an attribute of the data to be processed. The Predicate Analysis report displays all predicates involved in the SQL statement and indicates whether the predicate is indexable or sargable.

BPPAUDT ----------- AUDIT Message File ----------- 2002/12/03 16:45:43 COMMAND ===> SCROLL ==> CSR ------------------------------------------------------------- USER ID: xxxxxx SQL PREDICATE ANALYSIS: FILTER PREDICATE INDEX SARGE FACTOR -------------------------------------------------------- ----- ----- -------- STATEMENT #001 ---> A . COL2 = B . COL2 YES YES 0.50000* ---> A . COL4 = 'BOLT' YES YES 0.40000*

The information about the predicate is arranged in these four sections:

PREDICATE

The predicates contained in the SQL statement. Predicates are indicated by highlighted arrows. In the example, there are two predicates.

The report is not generated if a statement contains no predicates.

INDEX

Whether the predicates can match the entries in a suitable index. Possible values are:

■ Yes-The predicate is indexable.

■ No-The predicate is not indexable.

Note: In the example, all the predicates are indexable.

SARGE

Whether the predicate is sargable.

DB2 retrieves data and applies predicates in two stages. If a predicate can be applied by the Data Manager component of DB2, it is called a sargable predicate. If a predicate must be applied later by the RDS component of DB2, it is called a nonsargable predicate. Sargable predicates are more efficient because they require less processing.

Possible values are:

■ Yes-The predicate is sargable.

■ No-The predicate is nonsargable.

362 User Guide

Page 363: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

FILTER FACTOR

The estimate of the number of rows DB2 returns after applying the predicate. The Filter Factor is expressed as a number from 0 to 1, carried out to five decimal places.

As shown in the Predicate Analysis report, all predicates within the SQL can match an entry in an index. Remember, COL2 and COL4 were referenced by DEMO_SCENARIO1_IX in the Dependency report.

Press PF8 (Down) to scroll to the next report.

Rule Reports

CA Plan Analyzer can analyze SQL, physical, plan, and predicate rules. The rules help you to pinpoint problems within the explained SQL. The complete collection of SQL, physical, plan, and predicate rules is called a rule set. Because you left the RULESET field blank on the Explain Strategy Data Editor panel, the default rules for the DB2 version you are running are used.

For this tutorial, you selected the SQLRULE report. During enhanced explain processing, your SQL statements and underlying objects were analyzed against the default rule set. When a rule was violated, the rule is included in the SQLRULE report to show the violation. The rule is accompanied by a recommendation on how to fix the problem.

Appendix C: Quick Steps 363

Page 364: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Explain Strategy Services

The following panel shows the first SQL rule for statement 2 is 0002:

SQL DESIGN RULE: 0002 ------------------------ SEVERITY CODE = 0 THE COLUMN "COL2" FROM THE TABLE "PTI.DEMO_SCENARIO1" IS BEING COMPARED TO THE COLUMN "COL2" FROM THE TABLE "PTI.DEMO_SCENARIO2" IN THE FOLLOWING PREDICATE: A.COL2 = B.COL2 THE ATTRIBUTES OF THESE COLUMNS ARE: TABLE : PTI.DEMO_SCENARIO1 TABLE : PTI.DEMO_SCENARIO2 COLUMN: COL2 COLUMN: COL2 TYPE : VARCHAR TYPE : CHAR LENGTH: 20 LENGTH: 15 SCALE : 0 SCALE : 0 SINCE THESE ATTRIBUTES DO NOT MATCH, THIS PREDICATE IS NOT INDEXABLE (MATCHING INDEX) OR ELIGIBLE FOR THE DATA MANAGER'S STAGE 1 PROCESSING. RECOMMENDATION: 0092 IF THIS SQL STATEMENT IS EXECUTED FREQUENTLY, OR IF THESE COLUMNS ARE COMPARED IN OTHER SQL STATEMENTS THAT ARE EXECUTED FREQUENTLY, YOU must CONSIDER CHANGING THE ATTRIBUTES OF ONE OF THE COLUMNS TO MATCH THE OTHER. SQL DESIGN RULE: 0010 ------------------------ SEVERITY CODE = 0 THIS SQL ACCESSES THE TABLE "PTI.DEMO_SCENARIO2". THIS TABLE HAS THE FOLLOWING INDEXES DEFINED ON IT AND THE SQL IS NOT USING AN INDEX TO ACCESS THE DATA: "PTI.DEMO_SCENARIO2_IX" Press PF7/8 to Scroll Up/Down Press END (PF3/15) to quit

Report Conclusions

From the enhanced explain results, you can conclude that:

■ Statement 2 references COL2 of DEMO_SCENARIO1.

■ COL2 of DEMO_SCENARIO1 is indexable.

■ DEMO_SCENARIO1 has index DEMO_SCENARIO1_1X, with columns referenced by statement 2.

■ DEMO_SCENARIO1_IX is not being used to access the data from DEMO_SCENARIO1.

■ COL2 of DEMO_SCENARIO1 does not correspond with COL2 of DEMO_SCENARIO2 when statement 2 is executed to compare the two columns.

364 User Guide

Page 365: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Identifying SQL and Object Problems

■ COL2 of DEMO_SCENARIO1 has a VARCHAR column among CHAR columns.

■ DEMO_SCENARIO2 has index DEMO_SCENARIO2_IX, which is not being accessed.

Created Version

Press PF3 (End) to exit the Audit Message File panel and return to the Explain Strategy Services panel. The following message is displayed:

Strategy SCENARIO explained and version VERS1 created.

The following table describes parts of the Explain Strategy Services panel:

Message

Indicates that SCENARIO has been explained, and as a result, VERS1 has been created.

Version

The version name is indented and highlighted under the strategy name. Versions are listed from the least recent update to the most recent update.

TP (Type)

For versions, the Type field displays the explain status. Possible values are:

■ C-Complete. The explain has been executed for the version. You can only use the browse commands (I, O, and R) with a version of this type. The browse commands let you view the input and output values used during the explain.

■ I-Incomplete. The explain has not been executed for the version. This type is a useful reminder of what remains unexplained when you execute in batch mode.

Press PF3 (End) to return to the Main Menu.

While completing this section of the tutorial, you have created a strategy, explained a strategy, and determined that performance is degraded when statement 2 is executed. The next section, Identifying SQL and Object Problems, shows how to further pinpoint problems within the explained SQL and how to improve the performance by altering the objects referenced by the explained SQL.

Identifying SQL and Object Problems This section guides you through the basic steps of identifying problem SQL and objects.

Appendix C: Quick Steps 365

Page 366: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Identifying SQL and Object Problems

Problem Summary

From the previous tutorial section, you know that the SQL in plan PPASCEN1 can potentially cause poor performance. You saw that the problem was in statement 2 within DBRM PPA@SCE2.

Statement 2 references COL2 of table DEMO_SCENARIO1. Although COL2 is indexable and DEMO_SCENARIO1 has an index, the index is not being fully utilized to gather the data from the table.

Additionally, there is a problem with how the columns within DEMO_SCENARIO1 are arranged. COL2 is a VARCHAR column in the midst of CHAR columns. Also, COL2 has a length of 20, which causes a problem when compared to COL2 of table DEMO_SCENARIO2, with a length of 15.

Identifying Problem SQL

You can further analyze problem SQL using the CA Plan Analyzer Identify Problem SQL facility. With this facility, you can search for potential problem SQL based on search criteria you specify.

The power of Identify Problem SQL lies in its ability to customize your query using query configurations. These configurations include:

■ Search elements-Selecting one or more search elements limits your search to certain access and data retrieval method type(s).

■ Element conjunction-Designating an element conjunction (AND or OR) combines multiple search elements.

Accessing the Identify Problem SQL Option

To access the Identify Problem SQL option on the Main Menu, select 12 (Identify Problem SQL), and press Enter. The Identify Problem SQL panel appears.

366 User Guide

Page 367: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Identifying SQL and Object Problems

Generating the Identify Problem SQL Report

The Identify Problem SQL report tells you how DB2 accesses the SQL grouped within a strategy and how the chosen access and data retrieval methods affect performance.

In this example, the tables are large, so using a tablespace scan to access the data is undesirable.

To generate an Identify Problem SQL Report

1. Complete the following fields:

■ In the Report field, enter EP.

■ In the Name field, enter SCENARIO.

■ In the Creator field, enter your user ID. This indicates that your user ID is the creator of the SQL source.

■ In the Type field, enter ST to indicate that the SQL source is a strategy.

Press Enter.

The search element list displays with a message indicating that you must choose one or more search elements for the report.

2. In the Sel field next to Tablespace Scan(s), enter S.

This limits the search to include only the SQL that will use a tablespace scan when the SQL is executed.

Note: Because you have selected only one search element, the value in the (AND/OR) field is ignored.

Press Enter.

The Identify Problem SQL report appears.

Appendix C: Quick Steps 367

Page 368: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Identifying SQL and Object Problems

Interpreting the Identify Problem SQL Report

From the Access report, you discovered that statement 2 causes the DB2 Optimizer to access all the active data pages in the tablespace. From the Dependency report, you know the tablespace being accessed is PTIDEMO. The Identify Problem SQL panel simply reaffirms that tablespace scans are being used instead of indexes.

PPPIPSD ----------- PPA Identify Problem SQL ----------- COMMAND ===> explode SCROLL ===> CSR LINE 1 OF 9 > Report ===> EP HVersion ===> Plan ===> DBRM ===> STMTNO ===> Collid ===> Package ===> Name ===> SCENARIO Creator ===> USERXX Type ===> ST --------------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D71A Version ==> V7R1M0 HVERSION/LEVEL PART MGSCN NSTLP HYBRD TBLSP IX-ON CMD GROUP/OBJECT/STMT Type DCVC SORTS JOINS JOINS JOINS SCANS SCANS ____ PDGLS SCENARIO Stra ____ VERS1 ____ PPASCEN1 (PL) 3 2 1 - 5 - ____ PPA@SCE2 (D) 1 1 - - 1 - ____ 2 R 1 1 - - 1 - ____ PPA@SCE3 (D) 2 1 1 - 4 - ____ 3 R - - - - 1 - ____ 6 R - - 1 - 1 - ____ 11 R 2 1 - - 2 - ******************************** BOTTOM OF DATA *******************************

Note these fields on the Identify Problem SQL report:

GROUP

The name of the SQL source that contains the SQL you are working with. This example shows PPASCEN1, which is the plan that contains the SQL used to create the strategy SCENARIO. You specified this plan name (SQL Group name) on the Explain Strategy Data Editor panel when you created the strategy. For more information, see Creating an SQL Source Definition.

HVERSION

The historical version identifier of the SQL source. This example shows SCENARIO, which you accepted on the Historical Database Options panel when you originally created the strategy. For more information, see Specifying Historical Database Options.

368 User Guide

Page 369: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Object Reports

OBJECT

The name of the SQL object that contains the search element you are looking for. In this case, the object is the DBRM PPA@SCE2.

Report Fields

The section of the panel to the right of the item identification information shows you the number of times each access method is used for your SQL.

The example shows that, for the object PPA@SCE2, 1 MGSCN JOINS (merge scan join) and 1 TBLSP SCANS (tablespace scan) are used when the SQL of PPASCEN1 is executed.

Generating Object Reports The Identify Problem SQL facility confirmed that indexes are not being fully utilized. Recall that the SQLRULE report identified COL2 of DEMO_SCENARIO1 as having inappropriate attributes (COL2 as VARCHAR in one table and as CHAR in the compared table; VARCHAR appears between CHAR types). One solution is to alter COL2 of DEMO_SCENARIO1.

Recall that the Dependency report showed DEMO_SCENARIO1 was a dependent table of plan PPASCEN1. If you alter a dependent object, its plans will be invalidated. The Dependency report showed only the objects dependent on the selected SQL. What if DEMO_SCENARIO1 is dependent on plans other than PPASCEN1? You can quickly answer this question by using the CA Plan Analyzer Object Reporting.

Accessing the Object Reports Menu

The Object Reports menu permits you to specify header information and select the type of object report that to view.

The available object reports are listed in the middle of the panel. Notice that you can report on dependencies down to the column level.

The Option field repeats the option selected on the Main Menu. In this example, O (for Object Reporting) appears.

To access the Object Reports Menu

1. On the Identify Problem SQL panel, enter MAIN in the command line.

2. Press Enter.

The Main Menu appears.

Appendix C: Quick Steps 369

Page 370: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Object Reports

3. On the Main Menu, enter 9 in the command line.

4. Press Enter.

The Object Reports Menu appears.

Generating the Table Dependency Report

Based on the header information you enter on the Object Reports Menu, the Table Dependency report indicates which objects are dependent on the tables it lists.

To generate the Table Dependency report

1. Complete the following fields:

■ In the Report field, enter T to select the Table Dependency report.

■ In the Name field, enter DEMO_SCENARIO1 to report only on the SQL that references this table.

■ In the Plan field, enter PPA%. This field specifies the name of the plan referencing the object.

Note: The effects of accepting the default values is shown in the following fields:

■ Creator-The default (*) represents the ID used to create the object you specified in the Name field.

■ Where-The default (N) bypasses the Extended Query Facility (EQF).

■ Type-The default (D) generates the detail report format, which displays all dependencies, DBRMs, and SQL statements.

■ DBRM-The default (*) searches all DBRMs.

■ Collid-The default (*) searches all collections.

■ Package-The default (*) searches all packages.

2. Press Enter.

The Table Dependency report appears.

Note: Depending on the value specified for your PPA PARMLIB, the Resource Use Online panel might appear. If this panel displays, press Enter again to continue processing.

3. If your site does not request the Resource Use Online panel, the requested report is generated and displayed.

370 User Guide

Page 371: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Generating Object Reports

Interpreting the Table Dependency Report

The following illustration shows the Table Dependency report.

Note: To view the full SQL statement text, use the EXPLODE command.

PPPORL -------- Table Dependency (DET) -------- COMMAND ===> SCROLL ===> CSR LINE 1 OF 19 > Option ===> O Report ===> T Object ===> DEMO_SCENARIO1 Creator ===> * Where ===> N Plan ===> PPA% DBRM ===> * Type ===> D Collid ===> * Package ===> * ----------------------------------------------------------------- xxxxxx Location ===> LOCAL DB2 SSID ===> D71A Version ===> V7R1M0 CMD TABLE PLAN/COLLECTION DBRM/PKG STMTNO SQL STATEMENTS ____ DEMO_SCENARIO1 ____ PPASCEN1 ____ PPA@SCE2 ____ 2 DECLARE CURSOR_1 ____ SELECT B . COL ____ FROM PTI . DEM ____ WHERE A . COL2 ____ PPA@SCE3 ____ 3 DECLARE CURSOR_1 ____ SELECT A . COL ____ FROM PTI . DEM ____ 6 DECLARE CURSOR_2 ____ SELECT B . COL ____ FROM PTI . DEM ____ WHERE A . COL2 ____ 11 DECLARE CURSOR_3 ____ SELECT B . COL ____ FROM PTI . DEM ____ WHERE A . COL2 ******************************** BOTTOM OF DATA *******************************

Note these fields on the report:

Object

The object type and object name. In the example, TABLE is the object type and DEMO_SCENARIO1 is the object name.

PLAN/COLLECTION

The name(s) of plan(s) or collection(s) that are dependent on the object. In the example, PPASCEN1 is a dependent plan.

Appendix C: Quick Steps 371

Page 372: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Altering the Object

DBRM/PKG

The name(s) of the DBRM(s) or package(s) that are dependent on the object. In the example, PPA@SCE2 and PPA@SCE3 are the two dependent DBRMs.

SQL STATEMENTS

The SQL statements dependent on the object.

Viewing and Hiding Object Qualifiers

Knowing the qualifier for an object can often help you to search for or work with that object. Different kinds of objects have different qualifiers. For example, the qualifier of a table is the creator of the table. To display the object qualifiers, use the QON primary command on any object reporting panel. To hide the qualifiers, use the QOFF primary command.

To view object qualifiers, in the command line, enter QON and press Enter. The object report (which is, in this case, the Table Dependency report) displays the object qualifier, as shown in the Table Dependency (DET) panel.

As shown in this panel, the Creator field indicates that the creator of the table DEMO_SCENARIO1 is PTI.

To hide object qualifiers, in the command line, enter QOFF and press Enter. The object report reappears, without the qualifier column.

Altering the Object Based on the problem analysis, one solution would be to alter COL2 of table DEMO_SCENARIO1. To do this, submit the PPADEMOA job, which is included on the installation tape.

PPADEMOA contains the input needed to drop and recreate the necessary objects. Confirm with your system installer that PPADEMOA has been modified for your site. After it is modified, you can submit it through the Batch Processor Interface as 'HIGHLVL.SRCLIB(PPADEMOA)'.

372 User Guide

Page 373: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Correcting Plan Problems

Submitting the Data Set Online

You can use this procedure to submit an altered data set.

To submit an altered data set

1. In the command line, enter MAIN.

Press Enter.

The Main Menu appears.

2. In the command line, enter BP.

3. Press Enter.

The Batch Processor Interface panel appears.

4. Complete the following fields for the Execution Specifications section:

a. In the Execution Mode field, enter O.

b. In the DB2 SSID field, enter SSID.

5. Complete the following fields for the Batch Processor Input Dataset section:

a. In the Dataset Name field, enter 'highlvl.SRCLIB'.

b. In the Member field, enter PPADEMOA.

6. If necessary, change any other defaults for the Batch Processor that are needed for your site.

Press Enter.

The Batch Processor Wait panel appears.

When processing is complete, the Batch Processor Wait panel is replaced by the AUDIT Message File panel.

7. Use PF7 (Up) or PF8 (Down) to scroll the complete listing and confirm successful execution.

8. Press PF3 (End).

The Batch Processor Interface panel appears with a message indicating that the online execution completed.

9. Press PF3 (End) again to return to the Main Menu.

Correcting Plan Problems This section guides you through the basic steps for correcting plan problems.

Appendix C: Quick Steps 373

Page 374: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Correcting Plan Problems

Identifying Problem Plans and Packages

As discussed in the Identifying SQL and Object Problems section, Object Reporting displays only those objects dependent on the selected object. Predicting which plans have been invalidated (by altering an object) would be time consuming if you used only Object Reporting, especially if many objects have been altered. A more efficient alternative is to use CA Plan Analyzer's Identify Problem Plan/Package(s) facility to quickly identify all the plans invalidated by altering an object.

The Object Reporting output showed that plan PPASCEN1 referenced object DEMO_SCENARIO1. Therefore, PPASCEN1 was invalidated when you altered DEMO_SCENARIO1.

This exercise teaches you how to check the validity of plans and then use the Identify Problem Plan/Package(s) facility to execute a REBIND against the invalidated plan.

Accessing the Identify Problem Plan/Package(s) Facility

To access the Identify Problem Plan/Package(s) facility from the Main Menu, enter 11 in the command line, and press Enter. The Problem Plan/Package(s) Menu displays.

Selecting Plans or Packages for Display

The information you enter in the header fields on the Problem Plan/Package(s) Menu determines which plans or packages display. In this tutorial, you are interested in problem plans.

To select plans or packages, complete the following fields:

■ In the Name field, enter PPASCEN1.

■ Next to the Are Invalid (require BIND/REBIND) option, enter S. This indicates to search for invalid plans.

Note: The effects of accepting the default values is shown in the following fields:

■ Creator-The default (blank) is equivalent to using the asterisk wildcard character to indicate all values.

■ Where-The default (N) bypasses EQF.

Press Enter.

A list of problem plans displays that meet the criteria you entered.

374 User Guide

Page 375: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Correcting Plan Problems

Viewing the Problem Plan List

The information that you entered at the menu is used to display a list of plans or a list of packages matching the specified criteria. The Problem Plan List panel permits you to quickly view the plans matching the header information and option(s) you selected on the Problem Plan/Package(s) Menu.

The Problem Plan List panel displays information about a plan and when and how the plan was last bound. Press PF11 (Right) to view other fields.

Executing a REBIND from the Problem Plan List Panel

In the Problem Plan List panel, NO in the Valid field indicates that PPASCEN1 is not valid and must be rebound. In CA Plan Analyzer you can execute utility commands like BIND, REBIND, and FREE directly from a report list.

To rebind a plan from the Problem Plan List panel

1. In the CMD field next to the plan name, enter R to request a rebind.

2. Press Enter.

The Batch Processor Card Display panel appears.

The Batch Processor Card Display panel confirms the execution of any utility command before it is executed.

3. Press Enter to accept the batch input that will be used to REBIND plan PPASCEN1.

The Batch Processor In-Progress panel displays.

When processing is complete, the AUDIT Message File panel displays.

The message and the return code of 0 indicate that the REBIND was successful.

4. Press PF3 (End).

The Problem Plan List panel displays.

Note: The Valid field is still set to NO. You must regenerate the Identify Problem Plan/Package(s) report to update the field.

Appendix C: Quick Steps 375

Page 376: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reexplaining a Strategy

Generating Subreports

The CA Plan Analyzerreporting facilities accept subreport line commands. These commands allow you to access additional CA Plan Analyzer reports from within a CA Plan Analyzer report. These secondary reports are referred to as subreports. Valid subreport line commands are listed at the bottom of the panel.

To generate a Plan Detail report

1. In the CMD field, enter D.

Press Enter.

Note: Depending on the value specified for your PPA PARMLIB, the Resource Use Online panel might appear. If your site does not request the Resource Use Online panel, the Plan Detail report displays.

The Plan Detail report displays detailed information about the selected plan.

Note: The Valid field now contains YES. Because you executed the REBIND for PPASCEN1, the plan is now valid.

2. Press PF3 (End) to return to the Problem Plans List report.

3. In the command line, enter MAIN.

Press Enter.

The Main Menu displays.

Reexplaining a Strategy In the Creating a Strategy and Explaining the Strategy sections, you created and explained strategy SCENARIO. From the results, you determined the column attributes of DEMO_SCENARIO1 must change. After making the alterations, you rebound the plan that referenced DEMO_SCENARIO1. In this part of the tutorial, you will determine whether the object modifications had any effect on the DB2 Optimizer.

The source SQL associated with SCENARIO has not changed. Also, we want to generate the same enhanced explain reports. Rather than creating a new strategy, you can use the same strategy.

In this section, you will re-explain strategy SCENARIO. By re-explaining the same strategy with the same input configurations, you can easily see the improvements.

376 User Guide

Page 377: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reexplaining a Strategy

Setting Up the Explain

You can use this procedure to set up the Explain.

To set up the explain

1. On the Main Menu, select 2 (EXPLAIN Strategy Services).

Press Enter.

The Explain Strategy Services panel appears.

2. In the CMD field next to the strategy name (SCENARIO), enter E.

3. Press Enter.

The Version Info panel appears.

4. Complete the following fields:

■ In the Identifier field, enter VERS2. This is the name of the new version that will be created as a result of the explain.

■ In the Description field, enter EXAMPLE VERSION 2. This provides additional information about the version.

5. Press Enter.

The Explain Options panel appears containing the values you last entered.

Note: The values in the Primary AUTHID, Rule Set SSID, and Target SSID fields may be different on your display.

6. Press Enter.

The Batch Processor Card Display panel appears, showing the input statements that will be used to explain the strategy.

CA Plan Analyzer saves the input statements for the entire strategy, so you can use the strategy without reentering SQL source information or statistical changes.

Press Enter to begin processing.

The Batch Processor In-Progress panel appears.

When processing is complete, the AUDIT Message File panel appears.

Appendix C: Quick Steps 377

Page 378: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Reexplaining a Strategy

378 User Guide

Interpreting the Results

The same Enhanced Explain reports are generated as those requested for the first explain (that is, for VERS1). To interpret the results, go directly to the SQLRULE report.

To interpret the results

1. In the command line of the AUDIT Message File panel, enter FIND 'RULE 0002'.

Press Enter.

The AUDIT Message File panel displays the following message: STRING 'RULE 0002' NOT FOUND

From VERS1's SQLRULE report, we know rule 0002 was violated. This rule stated that the attributes of COL2 for tables DEMO_SCENARIO1 and DEMO_SCENARIO2 did not match. When you had requested to find that rule in the current report, a message indicated that the rule cannot be found because the alterations made to COL2 corrected this violation.

2. Press PF3 (End) to return to the Explain Strategy Services panel.

The following message displays: Strategy SCENARIO explained and version VERS2 created.

3. Press PF3 (End) to return to the Main Menu.

Page 379: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Appendix D: CA Plan Analyzer Health Checks

This appendix describes health checks for CA Plan Analyzer. The product owner for all CA Plan Analyzer health checks is CA_DB2.

DB2_PPA_EXPLAIN_RC1@xmanxxxx Description

This CA Plan Analyzer health check checks to ensure that the CA Plan Analyzer EXPLRC1 parameter is set to a non-zero return code.

Best Practice

Customize your PPA parmlib member. In the member, specify a non-zero return code (between 0001 and 4095) for the EXPLRC1 parameter.

Parameters Accepted

Explain Return Code 1 (EXPLRC1)

Specifies the return code (0000-4095) that you want passed to or from the batch processor when the explain has no statements to explain.

Debug Support

No.

Verbose Support

No.

Reference

For instructions on customizing the PPA parmlib member, see the CA Database Management Solutions for DB2 for z/OS Implementation Guide.

Messages

See the CA Database Management Solutions for DB2 for z/OS Message Reference Guide (AGT to PRR).

Appendix D: CA Plan Analyzer Health Checks 379

Page 380: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

DB2_PPA_EXPLAIN_RC2@xmanxxxx

DB2_PPA_EXPLAIN_RC2@xmanxxxx Description

This CA Plan Analyzer health check checks to ensure that the CA Plan Analyzer EXPLRC2 parameter is set to a non-zero return code.

Best Practice

Customize your PPA parmlib member. In the member, specify a non-zero return code (between 0001 and 4095) for the EXPLRC2 parameter.

Parameters Accepted

Explain Return Code 2 (EXPLRC2)

Specifies the return code (0000-4095) that you want passed to or from the batch processor when the explain has encountered an SQL error.

Debug Support

No.

Verbose Support

No.

Reference

For instructions on setting PPA parmlib parameters, see the CA Database Management Solutions for DB2 for z/OS Implementation Guide.

Messages

See the CA Database Management Solutions for DB2 for z/OS Message Reference Guide (AGT to PRR).

DB2_PPA_EXPLAIN_RC3@xmanxxxx Description

This CA Plan Analyzer health check checks to ensure that the CA Plan Analyzer EXPLRC3 parameter is set to a non-zero return code.

Best Practice

Customize your PPA parmlib member. In the member, specify a non-zero return code (between 0001 and 4095) for the EXPLRC3 parameter.

Parameters Accepted

Explain Return Code 3 (EXPLRC3)

Specifies the return code (0000-4095) that you want passed to or from the batch processor when the explain has encountered an internal processing error.

380 User Guide

Page 381: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

DB2_PPA_EXPLAIN_RC3@xmanxxxx

Appendix D: CA Plan Analyzer Health Checks 381

Debug Support

No.

Verbose Support

No.

Reference

For instructions on setting PPA parmlib parameters, see the CA Database Management Solutions for DB2 for z/OS Implementation Guide.

Messages

See the CA Database Management Solutions for DB2 for z/OS Message Reference Guide (AGT to PRR).

Page 382: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND
Page 383: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Index 383

Index @

@DEFAULT • 151

A

access path filters • 344 Access report • 359 accessing

Auto HVersion Maintenance facility • 313 Compare Explain Versions facility • 144 Explain Profile Maintenance facility • 319 Identify Problem Plans/Package(s) facility •

228 Query Explain Databace facility • 127 Reporting Services facilities • 167 Source Database Maintenance facility • 293 Statistics Manager • 265, 267 Stored Procedures Maintenance facility •

299 ACM (Alternate Catalog Mapping) • 340 altering objects

tutorial example • 372 Auto HVersion Maintenance facility

accessing • 313 browsing definitions • 316 creating definitions • 314 deleting definitions • 317 filtering selection lists • 315 introduction • 313 updating definitions • 316

B

batch input • 195 browsing

auto hversion definitions • 316 enhanced explain reports • 105 explain profiles • 322 strategies • 103, 115 version input statements • 105

C

CA Plan Analyzer authorizations • 53 strategy services • 55

commands EXPLODE • 132 RESET • 133

Compare Explain Versions facility accessing • 144 comparing versions

during explain processing • 144 of an existing strategy • 144

controlling report hierarchy • 144 introduction • 143 line commands • 145, 146

controlling report hierarchy Compare Explain Versions facility • 144 Identify Problem SQL facility • 231 Query Explain Databace facility • 129 Reporting Services facilities • 173, 179 Source Database Maintenance facility • 294

controlling version display • 104 cost filter • 343 Create User PLAN_TABLE(s) facility

cancelling batch input • 262 creating PLAN_TABLEs • 257 exiting the selected user queue • 261 filtering list of user IDs • 261 introduction • 257 verifying user authorizations • 262 viewing the selected user queue • 261

creating auto hversion definitions • 314 demo objects • 346 explain profiles • 319 PLAN_TABLEs • 257 SQL source entries • 88 strategies • 92, 100, 107, 114

current type explain @001 - @007 special SQL codes • 66 benefits • 65 preparing for • 67 specifying • 66

D

Database Information Display report • 139 DB2 system catalog

avoiding • 339 default rule sets • 151

Page 384: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

specifying search filter options • 122 deleting specifying source options • 110 auto hversion definitions • 317 specifying SQL qualifiers • 119 explain profiles • 323

introduction • 70 SQL sources • 295 regular mode strategies • 102

browsing reports • 105 versions • 104 browsing strategies • 103 demo objects browsing version input statements • 105 creating • 346 controlling version display • 104 Dependency report • 360 creating strategies • 92 DSN_FUNCTION_TABLE • 260 deleting strategies • 102 DSN_STATEMNT_TABLE • 260 deleting versions • 104 E specifying explain options • 95 updating strategies • 100 editing

tutorial example • 348 SQL source entries • 88 EXPLODE command • 132 editing SQL source entries • 88 exploding report displays • 132 executing an explain

Explain Strategy Services facility F expert mode • 98

Quick Explain facility filtering selection lists expert mode • 88 of auto hversion definitions • 315 regular mode • 82 of explain profiles • 321

exiting the selected user queue • 261 of user IDs • 261 Expert System Rule Text • 158 Source Database Maintenance facility • 294 Expert System Rules Exit Function table • 260

sample exit • 165 future type explain Explain Profile Maintenance facility benefits • 64

accessing • 319 specifying • 66 browsing profiles • 322 G creating profiles • 319 deleting profiles • 323 generating reports filtering selection lists • 321 Identify Problem Plans/Package(s) facility •

228 introduction • 319 updating profiles • 321 Identify Problem SQL facility • 232

Explain Strategy Services facility in batch • 181, 183 comparing strategy versions • 144 online • 171 expert mode Query Explain Databace facility • 128

browsing strategies • 115 Global Profile • 57 changing catalog statistics • 120

H creating strategies • 107 executing an explain • 98

header fields managing selection lists • 116

Reporting Services facilities • 168 selecting a rule set • 109

wildcard characters in • 171 selecting an explain profile • 86

historical versions • 143 specifying access path filters • 121

I specifying explain options • 98 specifying historical database options •

116 Identify Problem Plans/Package(s) facility generating reports • 228 specifying search conditions • 120 introduction • 223

384 User Guide

Page 385: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

PDTDYNR • 335 line commands • 229 PDTDYNT • 335 tutorial example • 41 PDTESQL • 335 understanding problem conditions • 223 PDTSTAN • 335 Identify Problem SQL facility PDTULD step controlling report hierarchy • 231

modifying • 334 generating reports • 232 PERF line command • 139 introduction • 231 performance data line commands • 235

loading • 335 tutorial example • 365 obtaining • 333 implementing CA Plan Analyzer in the

development cycle • 184 Performance Database Display report • 139 Performance Database Load Facility INFO line command • 139

loading data • 335 installation overview • 333 tutorial setup procedures • 345 POAPRFML • 335 L quick steps • 333 sample JCL • 335 line commands

performance recommendations Compare Explain Versions facility • 145 avoid the DB2 system catalog • 339 Identify Problem Plans/Package(s) facility •

229, 230 reduce the analysis request • 341 reduce the SQL analyzed • 343 Identify Problem SQL facility • 235, 236

Plan Analyzer see CA Plan Analyzer • 53 INFO • 139 PLAN_TABLEs PERF • 139

creating • 257 Query Explain Database facility • 140 filtering list of user IDs • 261 RES • 133

POAPRFML Source Database Maintenance facility • 296, 297 example • 335

required cards • 336 X • 132 PPA Database Maintenance authorization • 53 LNKPPAEX • 160 PPA main plan authorization • 53 Load facility PPA procedure maintenance authorization • 53 for Performance Database • 333 PPA rule administration authorization • 53 loading collection data into a sequential file •

333 PPADEMOA modifying • 347 loading performance data • 335 submitting • 372

M PPADEMOB modifying • 346 managing selection lists • 116

PPAEXIT • 160, 165 modifying PPLEXIT • 160 PPADEMOA • 347 Predicate Analysis report • 362 PPADEMOB • 346 product authorizations

O CA Plan Analyzer • 53 profile variables

object qualifiers modifying for tutorial • 348 tutorial example • 372 PSM main plan authorization • 53

Object Reporting facility tutorial example • 369

P

PDTDLOAD utility • 333

Index 385

Page 386: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Q Reporting Services facilities • 173 Source Database Maintenance facility •

294 Query Explain Database facility accessing • 127 Database Information Display • 139 controlling report hierarchy • 129, 134 Dependency • 360 Database Information Display report • 139 exploding displays • 132 generating reports • 128 generating introduction • 127 Identify Problem Plans/Package(s)

facility • 228 line commands • 140, 142 Performance Database Display report • 139 Identify Problem SQL facility • 232 switching among reports • 136 in batch • 181

Quick Explain facility online • 171 expert mode Query Explain Database facility • 128

changing catalog statistics • 120 Object Reporting facility, tutorial example • 369 editing SQL source entries • 88

executing an explain • 88 Performance Database Display • 139 managing selection lists • 116 Predicate Analysis • 362 specifying access path filters • 121 resetting displays • 133 specifying historical database options •

116 rule • 363 SQL statement detail • 358

specifying search conditions • 120 switching among specifying search filter options • 122,

125 Query Explain Database facility • 136 Reporting Services facilities • 172

specifying source options • 86 Table Dependency, tutorial example • 370 specifying SQL qualifiers • 119 RES line command • 133

introduction • 70 RESET command • 133 regular mode resetting report displays • 133

executing an explain • 82 rule reports • 363 quick steps tutorial • 345 rule sets

definition • 363 R Rule Text • 158

Recommendation Text • 158 S Reporting Services facilities accessing • 167 saving SQL sources • 294 controlling report hierarchy • 173, 179 scrolling generating reports in batch • 181, 183 Reporting Services facilities • 172 generating reports online • 171 search header fields • 168, 170 conditions • 343 introduction • 167 filters • 343 scrolling • 172 selected user queue switching among reports • 172 exiting • 261

reports viewing • 261 Access • 359 selecting a rule set • 109 controlling hierarchy selecting an explain profile

Compare Explain Versions facility • 144 Explain Strategy Services facility Identify Problem SQL facility • 231 expert mode • 86 Query Explain Database facility • 129,

134 sequential file record layout • 335

386 User Guide

Page 387: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

Stored Procedures Maintenance facility Source Database Maintenance facility accessing • 299 accessing • 293

strategy services, and maintaining CA Plan Analyzer objects • 55

controlling report hierarchy • 294 deleting SQL sources • 295

submitting filtering selection list • 294 PPADEMOA • 372 introduction • 293

switching among reports line commands • 296 Query Explain Database facility • 136 saving SQL sources • 294 Reporting Services facilities • 172 specifying explain options

SYSFIELDS • 342 Explain Strategy Services facility SYSINDEXPART • 342 expert mode • 98 SYSKEYS • 342 regular mode • 95 SYSRELS • 343 specifying source options • 86, 110 SYSTABLEPART • 341 SQL sources SYSVIEWS • 342 creating entries • 88

deleting • 295 T saving • 294 SQL statement detail reports • 358 Table Dependency report SRCCAT • 340 tutorial example • 370

enhanced explain card • 340 triggers • 260 SRCDBRML tutorial

enhanced explain card • 340 installer steps • 346 Statement Reporting. See Reporting Services

facilities • 167 setup procedures • 345 user steps • 347

Statement table • 260 U Statistics Manager

accessing • 265 UDFs (user-defined functions) • 260 authorizations • 53 unloading collection data • 333 browsing execution options • 285 Update Expert System Rules browsing strategies • 285 @DEFAULT • 151 browsing strategy versions • 285 default rule sets • 151 creating strategies • 271 updating deleting strategies • 286 auto hversion definitions • 316 deleting strategy versions • 286 explain profiles • 321 editing statistics • 287 strategies • 100 executing strategies • 281 using wildcard characters in header fields • 171 executing strategy versions • 281

V filtering list of strategies • 270 introduction • 265

verifying user authorizations • 262, 263 loading data • 283 versions managing DB2 objects • 272

historical • 143 managing strategy masks • 279 viewing the selected user queue • 261 selecting objects from the catalog • 273

W specifying statistics options • 274 toggling version display • 286

wildcard characters updating calculation options • 275 using in header fields • 171 updating execution options • 276

updating strategies • 280 viewing statistics reports • 287 viewing the Information report • 287

Index 387

Page 388: CA Plan Analyzer for DB2 for z/OS User Guide · CA Plan Analyzer® for DB2 for z/OS. User Guide . r12 . This documentation and any related computer software help programs ... BIND

388 User Guide

X

X line command • 132