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.
-->for job-1 use out-condition with "Nodate" -->for job-2 use job-1 Nodate outcondition as in-condition. once this job-2 is ended-ok delete job-1 condition. along with that put an job-2 outcondition with odate. -->in job-1 pre-conditions, check for the (job-1 out-condition with no-date OR job-2 out-condition with prev-date) and delete the conditions after use in pre-requisites only.
Execution flow. so, job-1 will run everyday and throws outcondition with nodate into database. next day when it runs, it checks for the (nodate condition of job-1 OR prev-date out condition of job-2) if any one of them is available, then it accepts that condition and deletes the same condition from database and triggers job-1.
whenever your job-2 is going to run, on that day it will check for the nodate condition of the job-1. if the job-1 is success, then it's nodate outcondition will be available for use and can be used to trigger the job-2. once job-2 is completed, nodate condition of job-1 will be deleted. and current odate outcondition of job-2 will be used in next day job-1 execution as job-1 nodate condition will not be available for use.
Thanks.