Friday, July 28, 2006
IBM Software Support Toolbar
The new IBM Software Support Toolbar plugs into your browser to allow you to search IBM's Support knowledge base using keywords, specific error codes or exact phrases. You can also use it to search or browse for product downloads including Fix Packs, Updates, Patches, etc. So if you have trouble remembering how to get to the IBM site for support, or just want a quicker way to get there, the IBM Software Support Toolbar could prove itself to be quite helpful.
The toolbar even allows you to seek specific results for a specific brand. So you can scroll to the "Information Management" brand and select from that sub-menu. That way you'd only be looking for the "database stuff"...
Wednesday, July 26, 2006
How and when to use DB2 scrollable cursors
If you are using DB2 V7 or higher, consider using scrollable cursors. With scrollable cursors, you can move directly to the rows you want without having to FETCH every other row returned by the cursor.
In DB2 V7, scrollable cursors require you to use declared temporary tables, another new feature of DB2 Version 7. If you are using DB2 V8, dynamic scrollable cursors are available and thus temprorary tables are not required.
In V7, DB2 uses a declared temporary table to hold and maintain the data returned by a scrollable cursor. Scrollable cursors allow developers to move through the results of a query in multiple ways. The following key words are supported when fetching data from a scrollable cursor:
- NEXT - will FETCH the next row, the same way that the pre-V7
- FETCH statement functioned
- PRIOR - will FETCH the previous row
- FIRST - will FETCH the first row in the results set
- LAST - will FETCH the last row in the results set
- CURRENT - will re-FETCH the current row from the result set
- BEFORE - positions the cursor before the first row of the results set
- AFTER - positions the cursor after the last row of the results set
- ABSOLUTE n - will FETCH the row that is n rows away from the first row in the results set
- RELATIVE n - will FETCH the row that is n rows away from the last row fetched
For both ABSOLUTE and RELATIVE, the number n must be an integer. It can be either a positive or a negative number and it can be represented as a numeric constant or as a host variable. All of the FETCH options for scrollable cursors also reposition the cursor before fetching the data. For example, let's consider your problem of a cursor that returns 1000 rows, but you only want rows 200 through 500.
Consider the following cursor logic:
DECLARE csr1 SENSITIVE STATIC SCROLL CURSOR
FOR SELECT FIRSTNAME, LASTNME
FROM DSN8710.EMP
ORDER BY LASTNME
FETCH FIRST 1000 ROWS ONLY;
OPEN csr1;
FETCH ABSOLUTE 200 csr1 INTO :FN, :LN;
I used the FETCH FIRST 1000 ROWS ONLY clause to ensure that no more than 1,000 rows were returned. This clause is, of course, optional (and if not specified, DB2 will not limit the result set returned by the cursor). Then I open the cursor and FETCH row 200. This positions the cursor just after the 200 result row that was just fetched. After that, all you would need would be to create a loop that just issues FETCH NEXT 300 times and that would retrieve only rows 200 through 500.
Basically, scrollable cursors reduce the amount of time and effort required to move backward and forward through the results of SQL queries. But as helpful as scrollable cursors are, do not make every cursor a scrollable cursor. Scrollable cursors require substantially more overhead than a traditional, non-scrollable cursor. Analyze the requirements of your applications and deploy scrollable cursors only where it makes sense to do so. Also, be sure to discuss this with your DBAs before implementing as there will probably be some setup work required of the DBA group to facilitate this solution.
Good luck...
Tuesday, July 25, 2006
Free DB2 Statistics Health Check Software
Statistics HealthCheck for DB2 z/OS enables you to quickly and effectively analyze and judge the quality of your DB2 Catalog statistics. Checking the health of your DB2 subsystem is especially important considering the heightened sensitivity of DB2 V8 and V9 to bad statistics.
The extensive rule system used by Statistics HealthCheck is based on IBM’s own recommendations for maintaining good statistics. Using a violation system, Statistics HealthCheck pinpoints precisely those objects that could benefit from a RUNSTATS utility health check—or that otherwise require statistics housekeeping.
Statistics HealthCheck is particularly useful as a prerequisite to Bind ImpactExpert during a V8 migration. First, Statistics HealthCheck identifies the RUNSTATs you need. Then, Bind ImpactExpert provides REBIND insurance to further guarantee consistent and improved access paths.
With Statistics HealthCheck, you know exactly what is “wrong” with your statistics so that you can proactively correct any problems that might negatively affect DB2 subsystem performance.
And come on, it is free after all. What do you have to lose by downloading it and trying it on your DB2 subsystems today?
--------------
Just a quick note to explain that since the links in this blog posting were no longer valid, I modified them. This offering is now being provided by SEGUS, and it is still a free download. The statistics health check software can be downloaded at the following link:
http://www.segus.com/index.php/productdetails/index/en_product_014_Statistics_HealthCheck
Friday, July 07, 2006
New Red Paper on DB2 and Storage
Disk storage has changed rapidly over the past few years with the delivery of new functions and improved performance. DB2 has made many changes to keep pace and make use of the disk improvements. In fact, there is a new "red paper" that outlines these changes titled Disk storage access with DB2 for z/OS.
A red paper is similar to a redbook, but it is shorter (in length) and focuses on a more limited subject matter. They are kind of in between a white paper and a redbook. But they are still free to download - and they are easier to digest quickly than a redbook.
If you don't know what a redbook is, check out my earlier blog posting on the subject: Can You Write a Redbook?
Thursday, July 06, 2006
"Messages & Codes" Now "Messages" and "Codes"
So, if you are looking for the meaning of a DSN message you would use the Messages manual; if you are looking for a SQLCODE or SQLSTATE, use the Codes manual. I kinda liked them both in one manual, but I guess the combined manual was getting a bit too big to manage...
Also, if you haven't used it already you might want to become familiar with LookAt. LookAt is an online facility for displaying explanations for most IBM messages, as well as for some system abends and codes.
You can use LookAt on the web at: www.ibm.com/eserver/zseries/zos/bkserv/lookat/
Or, you can use it from anywhere you can access a TSO/E command line. Of course, to use LookAt as a TSO/E command, LookAt must first be installed on your system. You can get the LookAt code via ftp at ftp.software.ibm.com/ps/products/ibmreader/tools/lookat/ZOS/