WLM on z/OS has a good ISPF interface, and old technology way of printing the configuration to an ISPF listing.
I wanted to compare the WLM configuration from one system with another system. It took a while to get this working.
Output the WLM report as XML
Go to the main WLM ISPF panel.
File Utilities Notes Options Help
---------------------------------------
Functionality LEVEL011 Definiti
Command ===> __________________________
Definition data set . . : none
Definition name . . . . . ETPwlm (R
Description . . . . . . . ETP WLM Poli
Select one of the following options.
__ 1. Policies
2. Workloads
- Select the FILE pull down.
- Select option 4 Save as
- It may display a screen of Errors / warnings. Press PF3
- It displays a pop-up “Save to…”. Specify a data set name and select Save format 1 (for XML)
The file is a sequential FB 80 file.
Download this to your work station (or run the Python on z/OS).
Create JSON format data from the file
I used the Python code
import xmltodict
import json
file="wlm.xml"
with open(file,"r") as myfile:
data=myfile.read()
data = data.replace('\n',"")
book_dict = xmltodict.parse(data)
json_data = json.dumps(book_dict,indent=1,sort_keys=True)
# print(json_data)
with open("data.json", "w") as json_file:
json_file.write(json_data)
This reads the file “wlm.xml” and creates a file “data.json”
This created
{
"ServiceDefinition": {
"@xmlns": "http://www.ibm.com/xmlns/prod/zwlm/2000/09/ServiceDefinition.xsd",
"ApplicationEnvironments": {
"ApplicationEnvironment": [
{
"Description": "WebSphere Application Server",
"Limit": "NoLimit",
"Name": "BBOC001",
"ProcedureName": "BBO5ASR",
"StartParameter": "JOBNAME=&IWMSSNM.S,ENV=ADCD.ADCD.&IWMSSNM",
"SubsystemType": "CB"
},
...
"ClassificationGroups": {
"ClassificationGroup": [
{
"CreationDate": "1999/11/15 19:19:26",
"CreationUser": "TODD",
"Description": "Production Batch High - Med",
"ModificationDate": "1999/11/16 11:17:21",
"ModificationUser": "TODD",
"Name": "BATHIM",
"QualifierNames": {
"QualifierName": [
{
"Description": "All SMP/E jobs",
"Name": "SMP*"
},
...
"Workloads": {
"Workload": [
{
"CreationDate": "1999/11/15 16:55:08",
"CreationUser": "TODD",
"Description": "All batch workloads",
"ModificationDate": "1999/11/15 16:55:08",
"ModificationUser": "TODD",
"Name": "BATCH",
"ServiceClasses": {
"ServiceClass": [
{
"CPUCritical": "No",
"CreationDate": "1999/11/15 17:17:54",
"CreationUser": "TODD",
"Description": "High Batch - med",
"Goal": {
"Velocity": {
"Importance": "2",
"Level": "60"
}
},
...
You can now use your favourite tools for extracting data and formatting.
Using Pandas
The Python code below produced simple reports.
import pandas as pd
import xmltodict
import json
file="wlm.xml"
with open(file,"r") as myfile:
data=myfile.read()
data = data.replace('\n',"")
book_dict = xmltodict.parse(data)
rg = book_dict["ServiceDefinition"]["Workloads"]["Workload"]
dd = pd.DataFrame.from_records(rg)
#pd.set_option('display.max_rows', 500)
#pd.set_option('display.max_columns', 500)
#pd.set_option('display.width', 1000)
print(dd)
Gave me
Name ... ServiceClasses
0 BATCH ... {'ServiceClass': [{'Name': 'BATHIM', 'Descript...
1 DB2RES ... {'ServiceClass': {'Name': 'STPCDDF', 'Descript...
2 IZUGWORK ... {'ServiceClass': [{'Name': 'IZUGHTTP', 'Descri...
3 SERVERS ... {'ServiceClass': [{'Name': 'SRVHIM', 'Descript...
4 STARTED ... {'ServiceClass': [{'Name': 'NOTRUN', 'Descript...
5 TSOOTHER ... {'ServiceClass': [{'Name': 'OTHER01', 'Descrip...
This shows that with a little Python code you can produce useful reports. People with experience of Pandas can format it better.