AutoSys Jobs, ZQL and Oracle Database

Since few months, I have been dealing with AutoSys Jobs at workplace and so far, have been running sendevent commands for triggering the AutoSys Jobs to handle commonly used scenarios, covered as follows;

  • CHANGE_STATUS
  • KILLJOB
  • FORCE_STARTJOB
  • STARTJOB
  • JOB_ON_HOLD, JOB_OFF_HOLD
  • JOB_ON_ICE, JOB_OFF_ICE

However, time had come that I started modifying the AutoSys Job definition using JIL, i.e. Job Information Language. So, to gain better understanding I started referring Unicenter AutoSys Job Management Reference Guide and have been exploring ever since.

AutoSys Relational Database

The interesting thing to know, the AutoSys Jobs definition, runtime information, etc is stored in Oracle Database and the guide states the following;

Because Unicenter AutoSys JM uses a relational database, you can query the database to supply custom reports and information.

Note: Using SQL commands to change information in Unicenter AutoSys JM tables may cause your system to fail. The Unicenter AutoSys JM tables and views listed in the following sections are for documentation purposes only. They are not intended to be used as a public interface and are subject to change between releases.

By default, the Unicenter AutoSys JM OS user is “autosys”. However, you may define a different ID for the OS user during installation.

So, the query language used for querying purpose is known as ZQL.

ZQL

If your Unix server has AutoSys installed, chances are you can view man pages as well for ZQL. I will give a brief overview in this blog post, through following ZQL query I wrote recently;

SELECT
A.as_group||','||B.text||','||A.job_name
FROM
<database>.ujo_jobst A,
<database>.ujo_intcodes B
WHERE
A.job_type = '<job_type-attribute>'
AND
A.as_group = '<group-attribute>'
AND
A.status = B.code
ORDER BY
job_name,
text
;

You may click on the hyperlink in the above query to learn more about the table/view definitions.

The column ujo_jobst.as_group (pulled from ujo_job2 table) contains the group information, which is usually specified in defining the AutoSys Job as follows;

group: <group-name>

The column ujo_jobst.job_type (pulled from ujo_job table) is straight-forward, contains either b/c/f, depending on whether its a Box/Command/File Watcher AutoSys Job.

job_type: b

The table ujo_intcodes, contains 3 columns only and code column is equivalent to the ujo_jobst.status column. So, the ujo_intcodes.text column contains values corresponding to each code like RUNNING, ACTIVATED, INACTIVE, FAILURE, etc.

As a result, I have pulled a report by executing ZQL script, having group-specific box AutoSys jobs along with their current status 😉

Advertisements