Enabling the SYSPROC.OPT_RUNSQL stored procedure on DB2 for z/OS® subsystems

By enabling the SYSPROC.OPT_RUNSQL stored procedure, you can capture the SQL statements from dynamic statement caches and store these statements in the DSN_STATEMENT_CACHE_TABLE table, if you do not have the privilege to run the EXPLAIN STMTCACHE ALL statement dynamically.

Procedure

To enable the C stored procedure SYSPROC.OPT_RUNSQL:

  1. Upload the tersed load module to the subsystem. You can find the load module in the \serverconfig\ZOS\z/OS_version_number_and_mode\Load Module subdirectory of the installation directory.
    Ensure that the following transfer rules are specified.
    ftp> quote site blk=6144 lrecl=1024 recfm=fb tracks unit=sysallda primary=90
    200 SITE command was accepted
    ftp> binary
    200 Representation type is Image
  2. Use the following sample job to unterse the load module to a partition data set.
    //***************************************************************
    //* Notes =
    //*  PRIOR TO RUNNING THIS JOB, 
    //*  locate and change the string "!!" to the following suffix
    //*  for the different versions of DB2 for z/OS:
    //*  For V8 and V10CM8, change to "J". 
    //*  For V9 and V10CM9, change to "K".
    //*  For V10NFM, change to "M".
    //***************************************************************
    //UNTERSE    JOB CLASS=A,MSGLEVEL=(1,1),                        
    //        NOTIFY=&SYSUID                                        
    //UNTERSE     EXEC PGM=TRSMAIN,PARM='UNPACK'                      
    //STEPLIB   DD DISP=SHR,DSN=IBMUSER.TERSE.LOADLIB               
    //SYSPRINT  DD SYSOUT=*,DCB=(LRECL=1024,BLKSIZE=6144,RECFM=FB)  
    //INFILE    DD DISP=SHR,DSN=USER.TERSED.AOCRNSQ!!                
    //OUTFILE   DD DSN=USER.UNTERSED,                                
    //  DISP=(SHR,CATLG,DELETE),                                    
    //  UNIT=3390,VOL=SER=DK8320,SPACE=(CYL,(5,5),RLSE)             
    /*   
  3. Copy the untersed load module to your user EXIT library.
  4. Ensure that the EXIT library is concatenated to your DB2® start task STEPLIB.

Feedback