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:
How can we configure the job so that CA7 demands it in with SCHID=1 at 9AM and with SCHID=3 at 3PM?
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
/path/to/scripts/set_instance_profile.sh#!/bin/sh
# Get the current hour in 24-hour formatCURRENT_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
chmod +x set_instance_profile.sh)Step 2: Update the Job Definition
${MFINST})JIL Definition Example:
insert_job: my_instance_jobjob_type: CMDcommand: auto_cnct -a TESTCCI -j JOBA -c DEMAND,${MFINST} -sCA7 -dmachine: agent_machineowner: autosys@hostnameprofile: /path/to/scripts/set_instance_profile.shdate_conditions: 1start_times: "09:00, 15:00"
Execution Flow:
/path/to/scripts/set_instance_profile.sh.export MFINST="INST1".${MFINST} runs in this environment, and its output is "INST1".export MFINST="INST3".${MFINST} runs, and its output is "INST3".