A reactive job is a job that Robot Schedule submits only after specified prerequisite conditions are met.
What conditions can be used as prerequisites? If the environment includes just a single IBM i running Robot Schedule, there are three types of prerequisites: another Robot Schedule job, an event, or a user job.
If the environment includes Robot Schedule Enterprise, there is also the ability to react to agent events that have occurred on a Robot Schedule Enterprise agent.
If the environment includes multiple IBM i systems connected via Robot Network, there is the ability to allow jobs on one system to react to jobs from a different system. Dependencies can be created based on a Robot Schedulejob or a user job from a remote system.
What are user jobs? User jobs are two specific types of system events caused by the SBMJOB feature or the SNDRBTDTA command.
The SBMJOB feature allows Robot Schedule to track the completion of all jobs submitted on the system (whether or not they're submitted through Robot Schedule). This information can then be viewed from a single place—the Robot Schedule Job Completion History panel. When the feature is turned on, the completion of any job on the system can be set up as a user job.
The SNDRBTDTA command can also be used to trigger the execution of a reactive job. If there is a program or job that is not run by Robot Schedule, the SNDRBTDTA command can be used within that program or job to tell Robot Schedule to submit the reactive job.
Note: The RBTEVTDTA command and SNDEVTDTA commands can be used to send completion data from Robot Schedule events or Robot Schedule Enterprise agent events, respectively.
Setting Up a Reactive Job
Let's assume a job is already set up and now it needs to react to something. Go to the Job Schedule List and enter option 2 next to the job. The Advanced Scheduling panel displays. To make a job reactive, enter a 1 next to the REACT option. Press F10 for the Reactive Jobs panel. This is where the prerequisite conditions are defined for this reactive job. Choose one or more of these options:
Press F6 to add a local Robot Schedule job.
If Robot Network is installed, press F15 to add a remote Robot Schedule job.
Press F14 to add a local user job, or enter the system name to add a remote user job.
If the reactive job has multiple prerequisites, create logical connections between them using simple AND/OR logic. Use the AND logical operand to combine prerequisites into a set. Use the OR operand to create separate sets of prerequisites. In this way, the prerequisites can be linked so that Robot Schedule submits the reactive job when all prerequisites are satisfied, when only one is satisfied, or when a combination of them are satisfied.
For example, suppose JOBD should run when both JOBA and JOBB complete, or when JOBC completes. Connect them logically as follows:
Change the sequence numbers to put the prerequisites in the desired order.
Finally, use the array of job statuses available to submit the job just when it should be submitted. Use any of the following codes in the React to Status field for a specific prerequisite.
C - normal completion
T - abnormal completion
E - either normal or abnormal completion
S - submitted status (submitted to a job queue)
R - running status (active in a subsystem)
D - delayed status (the status of a job that has been delayed by OPAL)
K - skipped status (the status of a job that has been skipped by OPAL)
P - pending status (the possible status of a job that has after-OPAL code attached)
To Schedule or Not to Schedule
There are three types of reactive jobs—immediate, day, and day/time. An immediate react is when the reactive job has no schedule (no run days or times have been entered in the Initial Job Setup panel). Once the prerequisite job statuses have been posted to the Reactive Jobs panel, Robot Schedule submits the reactive job.
For more control over when a reactive job runs, enter a day schedule. The most common way to do this is to enter the day on the Initial Job Setup Panel. Also, there are the INDAY, DATE, and DAYNO options on the Advanced Scheduling panel.
When the prerequisite requirements are met, Robot Schedule checks the run schedule of the reactive job. If it is scheduled to run on that day, Robot Schedule submits the job and clears the completion statuses on the prerequisite list. If the reactive job is not scheduled for that day, Robot Schedule does not submit the job and clears the completion statuses on the prerequisite list.
A date and time can also be entered for a reactive job to run. Each time the job is scheduled to run, Robot Schedule checks if the prerequisites for the job have been met. If they have, it submits the reactive job and clears the prerequisite statuses. If they have not, Robot Schedule doesn't run the job. Instead, it sends a warning message to Job Completion History and clears the prerequisite completion statuses at the day/time the reactive job was scheduled to run.
Note: If a run time is specified on a reactive job, there must also be a day or date specified for when the job should run. In addition, unless the Keep option is used, the prerequisite statuses are cleared every time the reactive job's scheduled run time occurs.