I'm using control-M for scheduling a few jobs, following is the scenario I face:
Job-1 - Runs daily (not at a specific time)
Job-2 - Ordered on the 1st of every month but runs say around the 10th (not fixed)
Now, I require Job-2 to be dependent on Job-1's execution. Say if job-2 becomes "eligible" for execution on the 12th, then it should only execute in the following scenarios:-
- Job-1 for 12th has executed successfully
- If job-1's execution is not scheduled for the 12th then Job-2 should check for the last successful execution (i.e. say maybe the 11th)
Job-2 should not execute if the last execution of Job-1 failed
What I've tried is, specifying the IN condition on Job-2 with date as PREV, but that doesn't seem to check for the current date's job-1 execution.
There are a few ways to tackle this:
The first would be to have two versions of job 1. The difference between the jobs is in the calandar. One runs all days except the day job 2 is to run. the second only runs on day 2, and this job creates the out condition that job 2 uses as an in conditions.
Another option is to create an out condition as a post process on job 1, then job 2 uses this condition as an in condition with ** as the odate - remember to remove this condition when job 2 completes (which is always a good practice).
syntax is on status = * (or some string in the sysout), compstat = OK, do add condition.
You could also force in job 2 as a post process, add to the on statement do force job.