I have created a
base sql template which will allow you to query jobs and their schedules by
agent name. It also includes checks to ensure that the job and schedule are
active.
**Note this does not
query jobs which are requested through request job conditions. It also only
includes the job or process flow header information. It does not list the
components within the process flows.
select DISTINCT
a.so_module, b.so_oper_name,c.aw_sch_name, c.aw_multi_start, c.aw_next_rundate
from so_job_table a,
so_operators b, aw_module_sched c
where a.so_job_seq
=c.aw_job_seq
and b.so_oper_name =
'Agent'
and a.so_active_flag
= 'Y'
and c.aw_active =
'Y';
*You will need to
replace 'Agent' with the name of the agent you wish to query jobs for.
You can add columns
from the tables referenced in the sql to display further information. The
aw_sch_name table includes further schedule details. The so_job_table contains
details particular to jobs. The so_operators contains agent specific details.
Feel free to add additional columns from the tables as needed.
If you wish to
include jobs that are requested through a condition you will need to include
the so_object_cond table which contains a column so_act_arg. This table can be
linked to the so_job_table and so_chain_detail table depending on where the
condition is set.
M - so_job_table for
Module and Chain header conditions.
so_object_cond.so_object_seq=so_job_table.so_job_seq
If the condition is
set within a process flow component then you need to add the so_chain_detail
table and use the following relationship
C - so_chain_detail
for process flow Component conditions.
so_object_cond.so_object_seq=so_chain_detail.so_det_seq
The requested job
name is included in this column so_act_arg which is in a string format. You
will need to parse through the string in your sql to find the job name which is
noted by the –m in the column.
Please note this sql
is provided as an example and will not be troubleshot by Automic if any issues
occur.