WebSphere Application Server & Liberty

JSR-352 (Java Batch) Post #97: SMF Accounting Data

By David Follis posted Wed July 01, 2020 07:55 AM

This post is part of a series delving into the details of the JSR-352 (Java Batch) specification. Each post examines a very specific part of the specification and looks at how it works and how you might use it in a real batch application.

To start at the beginning, follow the link to the first post.

The next post in the series is here.

This series is also available as a podcast on iTunesGoogle PlayStitcher, or use the link to the RSS feed

Last time we talked about the SMF 120 subtype 12 records that are written for Java Batch jobs run inside WebSphere Liberty.  A topic we didn’t get to was how you know who submitted which job (which might be related to who gets the bill for the CPU used by the job!). 

A common technique is to just map the job name to the owner.  The job name for a Java Batch job is the ‘id’ tag in the job element of the JSL.  Remember that this is just a string and can be longer than the eight-character length of a traditional JCL job name.  You might also want to recognize the job based on the actual name of the XML file packaged with the application that contains the JSL.  Both of these approaches assume some sort of internal standard for naming these things (and that people follow the standard…). 

You might also want to tie it back to the JCL job that submitted the Java Batch job.  If your Enterprise Scheduler submits JCL jobs that use batchManagerZos to submit the Java Batch job, then the jobname and id of the JCL job will automatically be propagated into Liberty and included in the Identification section of the SMF 120-12 record.  That might fit better into the ownership mapping scheme you already use.

The identity of the submitter of the Java Batch job (which might be the identity running the JCL job in the above scenario) also turns up in the SMF 120-12.  That might help, unless you have a functional id that runs all your batch workload.

Another option is the accounting string.  Traditional JCL allows an accounting string to be provided in the JOB card and the values will turn up in the SMF Type 30 records.  For Liberty Java Batch applications you can specify a job parameter whose name is com.ibm.ws.batch.accountingString and the value will be used to set the contents of the Accounting section in the SMF 120-12 record.

The value of that string is parsed apart at commas and each resulting sub-string is used to create an accounting section in the SMF record.  For example, if your accounting information consists of a department number and name, you could specify an accountingString whose value was “12345,CEOs Office” and the SMF record will have two accounting sections, one with the string “12345”and the other with “CEOs Office”. 

If you have a standard script that uses batchManagerZos to submit jobs, you can build into it the specification of accounting string value(s) as part of your standard processing.