When an SQL procedure, trigger, or function is created, DB2 UDB for iSeries generates a C program object with embedded SQL to implement the business logic described in the procedural SQL object. This C program implementation is transparent to the programmer because DB2 UDB takes care of the program creation and compilation.
Recently, a defect was discovered in V5R2 and V5R3 in which DB2 UDB for iSeries in certain cases was not using the optimization level parameter during compilation of the generated C program objects. Thus, these program objects could be missing out on compiler optimizations that could provide a small performance boost to SQL procedures, triggers, and functions.
To determine if any of your SQL procedural objects fall into this category, you can use the DSPPGM or DSPSRVPGM CL command to review the optimization level setting on the module-level detail screen. If the optimization level is set to *NONE, then your SQL procedural objects are affected by this defect.
There are two options available for remedying this situation. If you have the source code for the SQL procedure, trigger, or function, you can apply the following PTFs to your server.
- V5R2 PTF 5722SS1 SI18369
- V5R3 PTF 5722SS1 SI18358
After applying the PTFs, you can force the re-creations of the associated C program objects by dropping and re-creating your SQL procedure, trigger, or function.
If the source code is not available or you would prefer to change the optimization on an entire library of SQL procedural objects, then follow these steps to just change the optimization level.
1. Place this CL source in QGPL/QCLSRC.
DCL &LIB TYPE(*CHAR) LEN(10)
QSYS/CHGPGM PGM(&LIB/*ALL) OPTIMIZE(40)
QSYS/CHGSRVPGM SRVPGM(&LIB/*ALL) OPTIMIZE(40)
ENDCHGPGM: ENDPGM
2. Create the CL program.
3. Invoke the CL program, passing the name of a library containing SQL procedure, trigger, or function.
Kent Milligan is a DB2 UDB Technology Specialist on IBM's eServer Solutions Enablement team. He spent the first seven years at IBM as a member of the DB2 development team in Rochester. He can be reached at
LATEST COMMENTS
MC Press Online