Workload Manager Policy in XML Format – Part I

(Originally posted 2009-04-06.)

This isn't particularly new – but I'm guessing most people who work with WLM don't know about this…

For some time now you've been able to download a java application that enables you to convert your WLM Service Definition to and from XML. Perhaps more importantly, the application provides a nice way to edit the Service Definition – and that is actually its main purpose.

You can get the program from here. Unfortunately – from my perspective as someone who aspires to migrate to Linux over time – it is packaged for Windows. (I have mentioned this to Development – as it appears to be a java/Swing application and hence potentially portable.)

To retrieve the ISPF-based Service Definition, to convert it to and from XML, and to update it on z/OS a pair of batch jobs are used, submitted via FTP. If you get the setup right – and this is quite easy – the whole round-trip works well.

In any case the java application is a nice way to edit the Service Definition.

Now to the main purpose of this blog entry.

Manipulating the XML WLM Service Definition using PHP

The java application saves a copy of the XML Service Definition to your local workstation.XML is really nice as you can manipulate it in so many different ways.

Consider PHP, as an example. I may blog about this some more one day but I've installed Apache, with PHP support, on my Thinkpad. And this webserver is permanently up but only accessible via "localhost" URLs. (I've written a few scripts that automate most of the tedious parts of retrieving performance reports from the mainframe and displaying them.)

PHP is a good webserver scripting language, well suited to lots of tasks, and with an active development community. One of the things it's good at is processing XML. The following code example does some basic processing that's useful to me. You might find it useful to build on.


<?php
$dom=new DOMDocument;
$dom->load('wlmpolicy.xml');
$xpath=new DOMXPath($dom);
$xpath->registerNamespace("wlm","http://www.ibm.com/WLM/ServiceDefinition/Level008");

// List classification rules
echo "<h2>Classifications</h2>\n";
echo "<ul>\n";
$classifications=$xpath->query('/wlm:ServiceDefinition/wlm:Classifications/wlm:Classification');
foreach($classifications as $c)
{
  $subsysNode=$xpath->query("wlm:SubsystemType",$c);
  $subsys=$subsysNode->item(0)->nodeValue;
  $descNode=$xpath->query("wlm:Description",$c);
  $desc=$descNode->item(0)->nodeValue;
  echo "<li>$subsys - $desc\n";
  echo "<ul>\n";
  $crs=$xpath->query('wlm:ClassificationRule',$c);
  foreach($crs as $cr)
  {
    $qtypeNode=$xpath->query("wlm:QualifierType",$cr);
    $qtype=$qtypeNode->item(0)->nodeValue;
    $qvalueNode=$xpath->query("wlm:QualifierValue",$cr);
    $qvalue=$qvalueNode->item(0)->nodeValue;
    $sclassNode=$xpath->query("wlm:ServiceClassName",$cr);
    $sclass=$sclassNode->item(0)->nodeValue;
    $rclassNode=$xpath->query("wlm:ReportClassName",$cr);
    $rclass=$rclassNode->item(0)->nodeValue;
    echo "<li>$qtype - $qvalue ($sclass / $rclass)\n";
  }
  echo "</ul></li>\n";
}
echo "</ul>\n";?>

In XML terms the root node is <ServiceDefinition>. You can get to the classification rules with an XPath of

"/wlm:ServiceDefinition/wlm:Classifications/wlm:Classification"

The "wlm" in the above XPath expression refers to the need to register a namespace. The line

$xpath->registerNamespace("wlm","http://www.ibm.com/WLM/ServiceDefinition/Level008");

does that. Using this XPath expression yields a list of <Classification> nodes, which the code stores in the PHP variable $classifications. The rest of the code loops through the list, pumping out list items. Each list item in this sample describes the classification rule and (in brackets) the Service Class and Report Class the rule's firing leads to.

This is all simple PHP. I chose this small part of the WLM Service Definition to format as it's an example of something that's not in RMF's Type 72 record. When I look at how customers have set up WLM I really think I need to know how the classification rules were coded.

I'm hoping this code fragment will get you thinking about the value of having the WLM Service Definition in XML form. (By the way the XML form is saved on z/OS as part of the conversion and download process – and the conversion code is very visible if you nose around a bit.)

I've written "Part I" in the title of this blog post because I think I'm going to play with some more XML-related technologies – just to show the flexibility of the approach.

Published by Martin Packer

.

2 thoughts on “Workload Manager Policy in XML Format – Part I

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: