Playing Spot The Difference With WLM Service Definitions
MartinPacker 11000094DH Visits (4120)
A customer asked me to examine two WLM service definition snapshots taken on adjacent days - and discern any differences. This is not a challenge I’ve been set before - and so I expect it’s pretty rare. But, thinking about it, I reckon it could be quite useful.
So they sent me two service definitions, one day apart, and one from months later. When I say “a service definition” I mean the ISPF table library (TLIB) in which it’s stored. TERSEd and sent via FTP BINARY they make the trip just fine.
On my z/OS system I can fire up the WLM Service Definition Editor and read (and even edit) these just fine. (I could print the policy in a number of different formats - report, CSV file or GML. But I don’t choose to.)
I could even compare the two TLIBs but I don’t think that’d be a useful or consumable comparison. Likewise the three kinds of policy prints I just mentioned.
So, I decided to revisit an approach I’ve posted about before: Processing the XML version of the service definition.
Done right this could be a way to make a meaningful comparison - because it’s cogniscent of the structure of the Service Definitions.
When I last looked at the XML version I think I was on Windows. Now I’m on Linux. Unperturbed I downloaded the WLM Service Definition Editor - which is a .exe file. But it unpacks - with Archive Manager - anyway. Inside is, amongst other things, a jar file and two REXX execs - ISPF2XML and XML2ISPF.
(You can run the jar file under Linux and the SD Editor works. But that’s not what I was after.)
The ISPF2XML exec runs under REXX/ISPF and produces a very nice XML file.
In conversation with the author it transpires this isn’t actively maintained anymore and one should probably use the one from z/OSMF now. (I’d be interested in seeing some XML from the new editor - if anyone is using it and is willing to send me a file.)
Again, I could compare two XML files but I don’t think a raw textual comparison would be very helpful.
A Byproduct - An XML Formatter For HTML
Because the XML file is well-formed it’s quite easy to parse it. And it is quite comprehensible, in its own terms.
So, I wrote some PHP code that uses XPATH to process the file. Why PHP? Because I’m creating HTML (and serving it from Apache on my laptop to itself) and its XPATH support is very good.
So now I have a nice Formatter for the whole Service Definition: If you get to send me your XML I get to send you the HTML. And at the same time I get to understand more about how the classification side of your WLM policy works.
(RMF has nothing to say about WLM classification rules’ firing: I use SMF 30 to try to guess this stuff - but that has limitations. And for DDF work I have to rely on the DB2 Accounting Trace QWACWLME field.)
Comparing Two Service Definitions
I only got part way through writing the comparison code: I compared the first-level nodes (children of the root node, such as the ClassificationRules element) by using the saveHTML method and lexically comparing the strings produced.
Correctly this told me the overnight changes were twofold:
I say “correctly” because eyeballing my HTML reports told me the same thing: Opening the two of them in tabs, scrolling both to the top and then paging each down in turn took about 5 minutes. Doing it that slowly convinced me I’d spotted all the differences. (It helps I have built in some navigation aids along the way - which I won’t bore you with.)
Timestamps and Userids
Remember the two service definitions I’m comparing are from adjacent days. It’s handy they have timestamps for when e.g. A resource group was created. And always there’s a matching “update” timestamps.
Furthermore each timestamp is accompanied by a userid.
Sometimes these are goofy - “1900–01–01” or “N.N” - but it’s nice to see “CLW” appear, indicating the provenance of the service definition. (Even the goofy ones are, of course, meaningful.)
More seriously a timestamp between one day and the next is helpful.
RMF only gives you so much (but it’s a lot): Sometimes you need to go much further. And the XML version, whatever you do with it, fits the bill nicely.
Comparing two Service Definitions helps identify when changes were made. Picking up the timestamps narrows the doubt even more. And knowing the userids that authored changes helps drive discussions about who changed what and why.
You could readily save copies of the ISPF TLIB (or the XML) on a daily or weekly basis, and compare generations.
What I’d like to know is if a WLM Service Definition comparison tool would be generally useful for customers. Well would it?