Get status of jobs in Autosys using job command

Autosys is a tool which helps automating jobs across platforms. I had this need to find the status of a Job but all I knew was that the command used in the Job. When you have 2-3 jobs its quite easy to find the job and the status but when you have 100+ jobs its easy to run a query to get the information.

The below query can be used to find information about the job status.You need to run the query against the SQL Server database backend of Autosys. In the query I have declared a variable @GMTOffset. To get the GMTOffset value you can get the Offset value from the table “ujo_alAmOde”.

Declare @GMTOffset int;

select @GMTOffset =Int_val from ujo_alAmOde where [type] = ‘gmt_offset’; — (you need to get the GMTOffset value from ujo_alAmOde table)

select
jt.joid,jt.job_name,jt.job_type, jt.machine,
dateadd(second,jt.last_start-@GMTOffset,’1970-01-01′) as start_time,
dateadd(second,jt.last_end-@GMTOffset,’1970-01-01′) as end_time,
dateadd(second,jt.status_time-@GMTOffset,’1970-01-01′) as Last_Status_Time
,i.text
from ujo_jobst jt
inner join ujo_INTCODES i
on i.fld = ‘status’ and i.code = jt.status
where
dateadd(second,jt.status_time-@GMTOffset,’1970-01-01′) <> ‘1970-01-01 01:00:00.000’
–and  joid in (JOB_ID_OF_THE_JOBS_IF_KNOWN)
–and job_name like ‘%NAME_OF_THE_JOB%’ — NOTE: EVERYTHING IS CASE SENSITIVE
and jt.command like ‘%PART_OF_THE_COMMAND%’ — NOTE: EVERYTHING IS CASE SENSITIVE
ORDER BY Last_Status_Time desc

Note: Instead of Command, if you have “job id ” or “job name” you could uncomment those conditions.

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