Previous Topic: Bypassing a job without waiting for its predecessor

Next Topic: Running jobs in a different order based on time

Running different jobs based on the time a predecessor job completes

Objective

After jobs A and B complete successfully, a different group of jobs needs to run based on what time it is. If the time that job B completes successfully is prior to 15:00, the server should run jobs C and D. If the time is 15:00 or later, the server should run jobs E and F.

Solution

The dependencies look like this:

The diagram shows the requirement to run a different group of jobs based on the time a predecessor job completes.

To run different jobs based on the time a predecessor job completes

  1. Define jobs C, D, E, and F as request jobs.
  2. Use a task after job B that uses the following JavaScript script at run time. This script checks the time and takes the appropriate action.
    if (WOB._RHH < '15')
     {
      execCommand('C','%(APPL._name).%APPL._gen','ACTION REQUEST');
      execCommand('D','%(APPL._name).%APPL._gen','ACTION REQUEST');
     }
    else
     {
      execCommand('E','%(APPL._name).%APPL._gen','ACTION REQUEST');
      execCommand('F','%(APPL._name).%APPL._gen','ACTION REQUEST');
     }
    execCommand('CHECK.TIME','%(APPL._name).%APPL._gen','ACTION COMPLETE');
    

Explanation

After job B completes successfully, the server uses a task (for example, CHECK.TIME) that runs a JavaScript script to check the actual time. If the time is prior to 15:00, the server requests jobs C and D. If the time is 15:00 or later, the server requests jobs E and F. In either case, the server completes the task to enable the successors to run. The request jobs that are not requested are automatically bypassed.

A task is used in this example so that the server can check the time and take action before all of the successor jobs are released.

Built-in variables are used on each execCommand to represent the name of the Application and the generation number to ensure the actions are performed against the correct generation of the Application.