cancel
Showing results for 
Search instead for 
Did you mean: 

Schedule Dependency Scenario

former_member160248
Participant
0 Kudos

Hi,

I have a scenario that I cannot seem to find the right combination to get to work. I will try to describe.

Job "A" runs daily at 1:00am

Job "B" must

1. Wait for Job "A" to finish AND

2. Cannot start before 2:00am AND

3. dependent upon the existence of a file.

The catch is that the file that Job "B" is dependent does not get generated every day. In fact, it only gets generated once per month. As you can see then Job "B" really only runs once per month.

I set up an "event" for the file and ties to Job "B". call it "FILE_EVENT"

I set up a "raise" event which gets raised upon a complete status of Job "A".

I set up a time window from 2:00am to 3:00am and upon submit connected it to Job "B" with EVERDAY submit frame.

Basically, I want Job "B" to wake up everyday at 2:00am and check to see if the COMPLETE flag is raised AND the FILE_EVENT is raised. If both don't get raised before 3:00am then try again tomorrow at 2:00am

Currently if the file does not exist: the window closes; Job "B" does not run; and then reschedules for the next day which is perfect except that according to the new job instance created the COMPLETE flag is still raised. Therefore the next day if the file does exist Job "B" will start at 2:00am regardless of whether Job "A" for that day had completed yet.

I know its confusing and my attempt at a solution above is just 1 of a dozen that I have tried to no avail. Any help would be greatly appreciated.

Kind Regards,

David Carr

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

Does your job B clear the "A is completed" event ? This clear option is an option on the wait event you defined on job B.

This way, the next instance of B will wait for a new raise of the "A is completed" event.

The second part of your post seems to describe a slightly different scenario than the first part (the first part talks about B being a monthly job and the second part you have B defined as daily).

Both scenarios can be handled by chains, the second one very easily:

- create Job definition A

- create Job definition B, with wait event for the file (auto submit set to never, clear event set to yes) and a time window for 2:00 AM - 3:00 AM, with the overdue property set and the system parameter JCS_STATUS_ON_OVERDUE set to "A" (Cancel)

- create a Job chain with step 1 calling A, and step 2 calling B, postcondition on step 2: otherwise completed or otherwise raise error (your choice).

The job chain enforces the dependency between A and B, so B will wait for A. B will also follow it's time window, so never start before 2:00 AM, and it will wait for the file too. If it reaches 3:00 AM and B didn't start yet, the overdue properties will fire and set B to Cancelled, otherwise this chain execution would wait until the next day to run B.

This should do the trick. For the monthly scenario, you can use the same thing with just one addition: add a precondition to step 2 to decide if step 2 should be executed this day. There should be an example in the documentation for a period function that checks if a time window is open "now", you would need a slightly modified one to check if it will open "today".

Regards,

Anton.

former_member160248
Participant
0 Kudos

Thank you Anton. Once again you have hit the target. The solution provided with the first scenario did the trick. The "overdue" was the key. Never thought about using it in this context though I had ran accross it a time or two wondering where it might be of value.

Thanks again.

David

Answers (0)