Using Global Variables
search cancel

Using Global Variables

book

Article ID: 186248

calendar_today

Updated On:

Products

CA Workload Automation AE - Business Agents (AutoSys) CA Workload Automation AE - System Agent (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) Workload Automation Agent Autosys Workload Automation

Issue/Introduction

Looking for a way to use global variables in AutoSys to perform the following functions.

1) SQL query job obtains a value from the database and stores that value in an existing AutoSys global variable "BillID".  Later in the day, different jobs use the value of the variable a parameter.

2) Value of a variable is used as a condition to trigger jobs.

 

Environment

Release : 11.3.6

Component : CA Workload Automation AE (AutoSys)

Resolution


You can create a command job to run a script to query what you need from the db and return the results to a variable.
Use that variable's value in the autosys sendevent command to set an autosys global variable.
And yes, jobs can then use that global variable as their starting condition.

--- sample script ---
c_ename=`/opt/oracle/instantclient_11_2/sqlplus -s SCOTT/tiger@orcl <set pagesize 0 feedback off verify off heading off echo off
select ename from emp
where empno = 7566;
exit;
END`
sendevent -E SET_GLOBAL -G USER1=$c_ename
---

The above connects to the db and queries a table to get the username and then sets the username as the value for USER1 (the autosys global variable).

You could then use that in a 2nd job's definition.
Example :

condition: value(USER1)=JONES

For more details on conditions see:
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/intelligent-automation/workload-automation-ae-and-workload-control-center/11-3-6-SP8/reference/ae-job-information-language/jil-job-definitions/condition-attribute-define-starting-conditions-for-a-job.html#concept.dita_786915b26a4b3d5a37f3cedc0c9adf3d406804ea_GlobalVariableDependencies


For more details on global variables see:
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/intelligent-automation/workload-automation-ae-and-workload-control-center/11-3-6-SP8/reference/ae-commands/control-workload/sendevent-command-set-or-delete-a-global-variable.html