Find jobs ran for previous month

All questions about Control-M jobs definitions
Post Reply
User avatar
anirudhrh
Nouveau
Nouveau
Posts: 48
Joined: 21 Sep 2013 12:00

Find jobs ran for previous month

Post by anirudhrh » 05 Mar 2015 7:48

Hi all ,

we have a requirement to find the job count which have executed in the previous month.
is der a query or utility through which this can be done
Anirudh

ankitv
Nouveau
Nouveau
Posts: 2
Joined: 16 Feb 2015 2:28

Re: Find jobs ran for previous month

Post by ankitv » 05 Mar 2015 4:47

Hi Anirudh,

You can try the below SQL query to find the list of jobs that executed (irrespective of failure or successful execution of the job) for the previous month.

SELECT [APPLGROUP]
,[SCHEDTAB]
,[NODEID]
,[ODATE]
,[OSCOMPMSG]
,[JOBNAME]
FROM [ctrlm700].[dbo].[CMR_AJF]
WHERE
(STATUS = 'Y'
OR
STATUS = 'N')
AND
STATE = '8'
AND
ODATE >= ( select DATEADD(MONTH, DATEDIFF(MONTH, 0,GETDATE()) - 1, 0) )
AND
ODATE <= ( select dateadd(month,datediff(month,0,GETDATE()),0) )



And below SQL query to find the list of jobs that executed successfully for the previous month:
SELECT [APPLGROUP]
,[SCHEDTAB]
,[NODEID]
,[ODATE]
,[OSCOMPMSG]
,[JOBNAME]
FROM [ctrlm700].[dbo].[CMR_AJF]
WHERE
STATUS = 'Y'
AND
STATE = '8'
AND
ODATE >= ( select DATEADD(MONTH, DATEDIFF(MONTH, 0,GETDATE()) - 1, 0) )
AND
ODATE <= ( select dateadd(month,datediff(month,0,GETDATE()),0) )


Regards,
Ankit

Post Reply