Grouping SQLCODE information

Follow these steps to group SQLCODE information to locate problematic SQL activity of interest.

Procedure

  1. On the DB2 Query Monitor main menu, type 2 in the Option field and press Enter.
    Figure 1. DB2 QM SQL Code Summary panel
    YYYY/MM/DD HH:MM:SS  ------ DB2 QM SQL Code Summary -----  Row 1 of 2          
    Option  ===>                                                  Scroll ===> CSR  
    QM Subsystem : QM01         Interval Start Date: MM/DD/YYYY  Time: HH:MM:SS 
                                   Interval End   Date: CURRENT     Time: CURRENT  
    Group by  S    (P-Plan, D-DBRM/Package, A-Authid, S-SQLCode)                  
                   Specify "*" for no grouping                                     
    C: S-Select detail, P-Plans, D-DBRMs/Packages, A-AUTHIDs  
    ------------------------------------------------------------------------       
    CMD SQL Code     Occurrences                                                   
     -  --------  --------------                                                   
     _  -104                   3                                                   
     _  -204                   5                                                   
    ***************************** Bottom of Data **********************************
    
  2. Type the appropriate command in the Group By field to refine the display of information to suit your needs. For example, to group by Db2 authorization ID, type A in the Group By field and press Enter. The SQL Code Summary panel groups SQLCODE information by authorization ID:
    Figure 2. DB2 QM SQL Code Summary panel
    YYYY/MM/DD HH:MM:SS  ------ DB2 QM SQL Code Summary -----  Row 1 of 2          
    Option  ===>                                                  Scroll ===> CSR  
    QM Subsystem : QM01         Interval Start Date: MM/DD/YYYY  Time: HH:MM:SS 
                                   Interval End   Date: CURRENT     Time: CURRENT  
    Group by  A_   (P-Plan, D-DBRM/Package, A-Authid, S-SQLCode)                  
                   Specify "*" for no grouping                                     
    C: P-Plans, D-DBRMs/packages, S-SQLCODEs                                      
    ------------------------------------------------------------------------       
    CMD Authid      Occurrences                                                    
     -  -------- --------------                                                    
     _  USERID1               5                                                    
     _  USERID2               3                                                    
    ***************************** Bottom of Data **********************************
  3. When you have refined the grouping of SQLCODE information to locate activity of interest, you can issue line commands to drill down into a line item. For example, you can issue the P line command and press Enter to view plans associated with a line item.
    Figure 3. DB2 QM SQL Code Summary panel
    YYYY/MM/DD HH:MM:SS  --- DB2 QM SQL Code Group Summary ---  Row 1 of 1         
    Option  ===>                                                  Scroll ===> PAGE 
    QM Subsystem : QM01         Interval Start Date: MM/DD/YYYY  Time: HH:MM:SS 
                                   Interval End   Date: CURRENT     Time: CURRENT  
     Plan level SQLCODE summary for :                                              
       Primary Authid:  PDUSERA                                                    
    C: D-DBRMs/Packages, S-SQLCODEs                                               
    ------------------------------------------------------------------------       
    CMD  Plan     Occurrences                                                      
     --  -------- --------------                                                   
     __  PLAN01                5                                                   
    ***************************** Bottom of Data **********************************
  4. To view the SQLCODEs associated with a line item, type S in the CMD field and press Enter.
    Figure 4. DB2 QM SQL Code Group Summary panel
    YYYY/MM/DD HH:MM:SS  --- DB2 QM SQL Code Group Summary ---  Row 1 of 1         
    Option  ===>                                                  Scroll ===> PAGE 
    QM Subsystem : QM01         Interval Start Date: MM/DD/YYYY  Time: HH:MM:S 
                                   Interval End   Date: CURRENT     Time: CURRENT  
     SQLCODE data captured for:                                                    
       Primary Authid:  PDUSERA                                                    
       Plan Name:       DSNESPRR                                                   
                                                                                   
                                                                                   
     C:S - Select Detail                                                           
    ------------------------------------------------------------------------       
    CMD  SQLCODE   Occurrences                                                     
     --  --------- --------------                                                  
     __  -552                   3                                                  
     __  -551                   2                                                  
    ***************************** Bottom of Data **********************************

    You can now view SQLCODE details by issuing the S line command.