HCL Workload Automation, Version 9.4

Customizing jobs and job streams based on when they are scheduled to run

This scenario shows how to customize jobs and job streams based on when they are scheduled to run, that is on which days they run, using variable tables referenced at the run cycle level.

By having the ability to manage different tables of variables in run cycles, you no longer need to define two different job streams to run the same work on different data. Instead, you define:
  • A single job stream with two run cycles, referencing two different variable tables.
  • File dependencies on jobs using variables, forcing instances generated on a specific day to use different variable values with respect to instances generated on another day.
  • A variable in the path of the scriptname job attribute.

Using variable tables you reduce the number of scheduling object definitions required to implement your workload saving time and money.

Using variable tables you need to define less scheduling objects required to implement your workload with respect to the past saving time and money.

You can find more information on this subject in the User's Guide and Reference.

Scenario goal

A sales department needs to collect sales data to produce reports both at a business unit level and at a corporate level. The department manager needs reports both weekly and monthly. Report data is stored in two different directories. Data for weekly reports is stored in a file located in the /reports/weekly directory. Data for monthly reports is stored in a file located in the /reports/monthly directory.

The files containing the input data needed to generate the reports are stored in two different directories, and the job stream used to generate reports has a dependency on these files. To collect data you can now create one job stream with two different run cycles (one that runs weekly and one that runs monthly) that reference two different variable tables containing a variable that is in the file path.

Roles and skills

This section lists the users involved in the scenario, the related roles, and the required skill level:
HCL Workload Automation Job Scheduler
Manages Tivoli Workload Scheduler workload. Required skills include Tivoli Workload Scheduler knowledge.

System requirements

Install the following software before starting the scenario:
  • HCL Workload Automation version 8.5
  • Dynamic Workload Console version 8.5

Setting up the environment

Complete the following tasks before running the scenario:
  • Install and configure HCL Workload Automation version 8.5
  • Install and configure Dynamic Workload Console version 8.5

Running the Scenario

To complete the scenario, perform the following steps:

Procedure

  1. Define the SC1_WEEKLY_DATA_TABLE and the SC1_MONTHLY_DATA_TABLE variable tables as follows:
    VARTABLE SC1_WEEKLY_DATA_TABLE
      MEMBERS
      REP_PATH "/reports/weekly"
    END
    
    VARTABLE SC1_MONTHLY_DATA_TABLE
      MEMBERS
      REP_PATH "/reports/monthly"
    END
  2. Locate the jobs used to generate the reports. The jobs run a script which receives the directory name as an input argument as shown in the syntax below:
    SC1_PARSE_DATA SCRIPTNAME 
               "/reportApp/parseData.sh ^REP_PATH^" STREAMLOGON salesadm
    SC1_PROCESS_DATA SCRIPTNAME 
               "/reportApp/processData.sh ^REP_PATH^" STREAMLOGON salesadm
    SC1_CREATE_REPORTS SCRIPTNAME 
               "/reportApp/createReports.sh ^REP_PATH^" STREAMLOGON salesadm
  3. Define a single job stream with the following content:
    1. Two run cycles:
      • A weekly run cycle referencing the SC1_WEEKLY_DATA_TABLE variable table
      • A monthly run cycle referencing the SC1_MONTHLY_DATA_TABLE variable table
    2. A dependency on the file containing the data used for report generation.
    3. A variable used in the path of the job stream file dependency.
    SCHEDULE SC1_RUN_REPORTS
      ON RUNCYCLE SC1_MONTHLY_RCY VARTABLE SC1_MONTHLY_DATA_TABLE 
         "FREQ=MONTHLY; INTERVAL=1; BYMONTHDAY=27" AT 0800
      ON RUNCYCLE SC1_WEEKLY_RCY VARTABLE SC1_WEEKLY_DATA_TABLE
         "FREQ=WEEKLY; INTERVAL=1; BYDAY=FR" AT 0900
      OPENS "^REP_PATH^/raw_data.out" 
      :
      SC1_PARSE_DATA 
      SC1_PROCESS_DATA FOLLOWS SC1_PARSE_DATA
      SC1_CREATE_REPORTS FOLLOWS SC1_PROCESS_DATA
    END
  4. Create a plan of 30 days to generate multiple instances of the job stream by running the following command:
    JnextPlan -days 30

Expected results

The REP_PATH variable assumes different values according to the run cycle that applies, that is according to the variable table referenced in the corresponding run cycle.

In this way, the job stream instances have a dependency on a different file according to the type of report they are producing, monthly or weekly. That is:
  • The job stream instances that generate the weekly report have a dependency on the file containing the data located in the directory /reports/weekly.
  • The job stream instances that generate the monthly report have a dependency on the file containing the data located in the directory /reports/monthly.
Furthermore, the name of the target directory is correctly replaced in the task string of the three jobs run by every job stream instance as follows:
  • The jobs run by job stream instances that generate the weekly report run shell scripts with the /reports/weekly directory as an input argument.
  • The jobs run by job stream instances that generate the monthly report run shell scripts with the /reports/monthly directory as an input argument.