Viewing SQL statements for a package

You can use Db2 Admin Tool to view the SQL statements that are included in a package.

Procedure

To view SQL statements for a package:

  1. On the DB2 Administration Menu (ADB2) panel, specify option 1, and press Enter.
  2. On the System Catalog (ADB21) panel, specify option K (for packages), and press Enter.
  3. On the Packages (ADB21K) panel, specify the SQ line command next to the package for which you want to view the SQL statements.
    The Extracted SQL (ADB21KSE) panel displays the SQL statements in the package:
    Figure 1. Extracted SQL (ADB21KSE) panel
    ADB21KSE  ----------------- Extracted SQL ---------------- Columns 00001 00072
    Command ===>                                                  Scroll ===> CSR 
    
    ****** ***************************** Top of Data *****************************
    ==MSG> Use primary command "EXPLAIN" to explain or PLANTAB to display the     
    ==MSG> explain rows for the selected SQL statement using line command "C" or  
    ==MSG> block line command "CC".                                               
    ==MSG>                                                                        
    =NOTE= -- SQL statements in  PACKAGE  : ADBB2PAR.ADB2REM.(V11.2.0.0000000)    
    =NOTE= -- SQL in stmt:   3041 (Stmt id:589559)                                
    000001 SET :H = GETVARIABLE ('SYSIBM.PLAN_NAME', 'D_PLNAME' )                 
    =NOTE= -- SQL in stmt:   3048 (Stmt id:589560)                                
    000002 SET :H = GETVARIABLE ('SYSIBM.PACKAGE_SCHEMA', 'D_PKSCH' )              
     ****** **************************** Bottom of Data ****************************
  4. Optional: To get EXPLAIN information for one or more of the listed SQL statements, issue the C line command or the CC block line command and specify one of the following primary commands:
    EXPLAIN
    Explains the selected SQL statement.
    PLANTAB
    Displays EXPLAIN rows for the selected SQL statement.
    The EXPLAIN (ADB2E) panel is displayed.