We are using Control-M to submit several batch jobs to a legacy application, but due to limitations, the only way to monitor their status is by querying the Process table of the DB.
Process
table:
JobNum | JobStat | Batch |
---|---|---|
1 | Finished | ABC |
2 | Failed | ABC |
3 | Started | ABC |
4 | Started | ABC |
I am trying use Cyclic Database job to query the Jobs, and rerun ever 5min while there are still jobs in Started
, but have it break when:
- The query result is empty (No jobs exist for that batch) - set to
Not OK
- All jobs are in either
Finished
orFailed
in the batch - set toOK
Currently, I am trying to do something like:
SELECT 'TotalJobs', COUNT(JobNum)FROM ProcessWHERE Batch = 'ABC'SELECT 'StartedJobs', COUNT(JobNum)FROM ProcessWHERE Batch = 'ABC' AND JobStat = 'Started'SELECT 'CompletedJobs', COUNT(JobNum)FROM ProcessWHERE Batch = 'ABC' AND JobStat IN ('Finished', 'Failed')
Then using On-Do Actions with Specific statements like -
Statement: *Code: TotalJob,0Set-NotOK
Statement: *Code: StartedJobs,0Set-OK
But it does both actions...
Is this possible to do this more complex analysis with On-Do Actions?
Thanks