AutoSys Connect (CCI): How to demand a single job into multiple CA7 instances at different times of day
search cancel

AutoSys Connect (CCI): How to demand a single job into multiple CA7 instances at different times of day

book

Article ID: 413613

calendar_today

Updated On:

Products

Autosys Workload Automation

Issue/Introduction

There is a business requirement where we need to run an AutoSys job which demands a job into CA7 using a specific SCHID on the mainframe at a certain time and a second execution later in the day using a different SCHID. 

The job is DEMANDed in by the AutoSys job through AutoSys Connect (CCI).

Requirements:

  • The job runs twice daily.
    • Once at 9AM using SCHID=1
    • And, again at 3PM using SCHID=3

How can we configure the job so that CA7 demands it in with SCHID=1 at 9AM and with SCHID=3 at 3PM?

Resolution

Use a Time-Aware Job Profile
This approach uses a shell environment variable rather than an AutoSys global variable in the final command, but it perfectly achieves the goal of changing the parameter based on time.

Step 1: Create the Profile Script

  • Create a shell script on the agent machine where the job will run. This script will check the current time and export an environment variable named MFINST.

    Example script:
    /path/to/scripts/set_instance_profile.sh
    Note: Script below is just an example for illustrative purposes. 

    #!/bin/sh

    # Get the current hour in 24-hour format
    CURRENT_HOUR=$(date +%H)

    # Set the MFINST environment variable based on the time
    # Runs in INST1 before noon, and INST3 after noon.
    if [ ${CURRENT_HOUR} -lt 12 ]; then
      export MFINST="INST1"
    else
      export MFINST="INST3"
    fi

  • Make sure this script is executable (chmod +x set_instance_profile.sh)

Step 2: Update the Job Definition

  • Modify your job to use this profile and reference the variable as an environment variable (${MFINST})

JIL Definition Example:

insert_job: my_instance_job
job_type: CMD
command: auto_cnct -a TESTCCI -j JOBA -c DEMAND,${MFINST} -sCA7 -d
machine: agent_machine
owner: autosys@hostname
profile: /path/to/scripts/set_instance_profile.sh
date_conditions: 1
start_times: "09:00, 15:00"


Execution Flow:

  • First Run (at 09:00):
    • AutoSys sources the profile script: /path/to/scripts/set_instance_profile.sh.
    • The script sees the hour is less than 12 and executes export MFINST="INST1".
    • The job's command echo ${MFINST} runs in this environment, and its output is "INST1".

  • Second Run (at 15:00):
    • AutoSys sources the profile script again.
    • The script sees the hour is not less than 12 and executes export MFINST="INST3".
    • The job's command echo ${MFINST} runs, and its output is "INST3".