2.4.6 Executing a specific process when a job ends abnormally (example of defining a jobnet that uses a recovery unit)
Use a recovery unit when defining a jobnet in which a process is executed only if a job ends abnormally.
You can set a recovery unit by entering Recovery in Type in the Attributes definition of the job or jobnet. Any job or jobnet can be set the recovery attributes.
- Organization of this subsection
(1) Example of defining a jobnet that uses a recovery job
In the example below, a recovery job is used in defining a jobnet that performs a stock check, and then creates an order entry form if there is adequate stock. If there is insufficient stock, the stock check job ends abnormally, a purchase order form is created, and then the order entry form is created.
In this example, the stock check job returns 5 or a higher value if the execution result indicates a stock shortage.
First, set Judgment by threshold as the end judgment of the stock check job and set the abnormal threshold to 4. (That is, the stock check job ends normally if the return code is 4 or lower, or ends abnormally if the return code is 5 or higher.) If the stock check job ends normally, the create order entry form job will be executed next. Therefore, leave Normal (default) as the create order entry form job's Type setting. If the stock check job ends abnormally, the create purchase order form job will be executed next. Therefore, set Recovery in Type in the Attributes definition of the create purchase order form job. When this job ends, the create order entry form-R job will be executed. Set Recovery in Type for this job too (because only a recovery unit can be defined as the succeeding unit of a recovery unit).
Accordingly, the succeeding job of the stock check job is as follows:
-
When the return code is 4 or lower
The check result shows adequate stock and the stock check job ends normally. The succeeding job (create order entry form) will be executed next.
-
When the return code is 5 or higher
The check result shows that stock is too low and the stock check job ends abnormally. The recovery job (create purchase order form) is executed. When this job ends normally, the succeeding job of the recovery job (create order entry form-R) is executed.
Note that when a recovery unit is executed (because the preceding job ended abnormally), even if that recovery unit ends normally, the entire jobnet in which those units are defined is assumed to have ended abnormally. Also, if no preceding job is defined, the recovery unit is not be executed and is set to Not executed + Ended status.
- Supplementary note
-
When you define an OR job as a recovery job, you must define its preceding event jobs and its succeeding job as recovery jobs.
(2) Example of defining multiple preceding jobs for a recovery unit
You can define multiple preceding jobs for a recovery unit. In this case, the recovery unit will be executed only if all the preceding jobs end abnormally. An example of defining multiple preceding jobs for a recovery job is shown below.
In this example, recovery job A is executed only if standard jobs A, B, and C all end abnormally. Recovery job B is executed following normal termination of recovery job A.