More On Native Stored Procedures
MartinPacker 11000094DH Visits (258)
This follows up on Going Native With Stored Procedures?, and it contains a nice illustrative graph.
I could excuse a follow up so soon with the words "imagine how unreadably long the post would be I had written this as all as one piece”.
However, the grubby truth is I got to write some code I didn’t expect to just yet. And this post became possible as a result.
Where Were We?
The gist of the previous post is:
And that’s where we (and my code) left it. A useful place to be but not the best that could be done.
The New Code
So, for the very same study as in Going Native With Stored Procedures?, I began to dig, and to teach my code new tricks.
I wanted to know more about the stored procedures that weren’t zIIP-eligible.
To do that would take processing of package-level Db2 Accounting Trace (SMF 101).
Package-Level SMF Records
There are two types of SMF 101:
Each IFCID 239 record contains up to 10 QPAC Package Sections, each describing one package name. I emphasise “name” because you don’t get one each time you call a stored procedure with that name. Instead you get one section for all calls that invoke that package.
My Old Package-Level Code
To be honest, I stopped earlier with developing my package-level code than I wanted to. The code takes an IFCID 239 record and “flattens” it, with each Package Section placed in a fixed position in the output record.
So, I have records still with up to 10 package names in them.
If you’d sent me Package-Level Accounting for a study involving DDF my code flattened the records and left it at that. There was no reporting.
My New Package-Level Code
Now I have code that takes a 10-package record and turns it into 10 1-package records. I also have some reporting.
The interesting bit is the reporting.
I create a CSV file, sorted by subsystem and, within that, GCP CPU. Each line is a separate Correlation ID and Package combination. There is a nice field in the QPAC section (QPACAAFG) which says which type of package it is. Here are the values QPACAAFG can take.
Notice anything strange about the above table?
I think the X’0000’ is odd but it’s probably indicating “this field not filled”.
In any case you can readily tell what kind of package we have.
When I import the CSV file into Excel (and hold my nose) I get a useful spreadsheet. I define a field which is the concatenation of the package type and its name. That enables me to produce a nice graph. Here’s an example.
It shows CPU seconds - both GCP and zIIP - for the 20 packages with the biggest GCP CPU.
I’ve obfuscated all but one package name. We’ll get to that. But here are some observations:
Most of the rest of the packages are non-native stored procedures, with a couple of native ones. The zIIP usage is much as you would expect.
Let’s return to SYSLH200. It’s a Db2-supplied default package. You see it a lot. In a different subsystem it’s - by miles - the biggest package. This would be entirely normal for a subsystem that wasn’t a heavy user of explicit DDF packages, such as stored procedures.
Here’s a table of such package names:
Now I can spot them I’ve added this table to my bank of standard slides to use in customer engagements. I’ll add other well-known package names over time.
For this subsystem it’s clear the customer has some familiarity with Native Stored Procedures, whether accidentally or intentionally. (It’s possible the native ones were supplied by a vendor and the install script set up the Db2 Catalog to enable them.) But this customer has some way to go - assuming the remaining major stored procedures can and should be converted to native.
This code is going into Production - Just as soon as I can find the time to convert the JCL to an ISPF File Tailoring skeleton.
But I’m already using it so it is in a sense in Production.
So if I ask you for package-level Db2 Accounting Trace this will be one of the good uses I’ll put it to.
The Journey Continues
I’m sure there’ll be “another thrilling instalment” in the DDF saga. I just have no idea right now what what it would be.