track: esp working with ca esp workload automation variables · pdf filetrack: esp working...
TRANSCRIPT
Track: ESPWorking with CA ESP Workload Automation Variables
Steve Wotton , Workload Automation Consultant
Terms of This PresentationThis presentation was based on current information and resource allocations as of October
2009 and is subject to change or withdrawal by CA at any time without notice.
Notwithstanding anything in this presentation to the contrary, this presentation shall not serve
to (i) affect the rights and/or obligations of CA or its licensees under any existing or future
written license agreement or services agreement relating to any CA software product; or (ii)
amend any product documentation or specifications for any CA software product. The
development, release and timing of any features or functionality described in this presentation
remain at CA’s sole discretion. Notwithstanding anything in this presentation to the contrary,
upon the general availability of any future CA product release referenced in this presentation,
CA will make such release available (i) for sale to new licensees of such product; and (ii) to
existing licensees of such product on a when and if-available basis as part of CA maintenance
and support, and in the form of a regularly scheduled major product release. Such releases
may be made available to current licensees of such product who are current subscribers to CA
maintenance and support on a when and if-available basis. In the event of a conflict between
the terms of this paragraph and any other information contained in this presentation, the
terms of this paragraph shall govern.
2 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
For Informational Purposes Only
Certain information in this presentation may outline CA’s general product direction. All
information in this presentation is for your informational purposes only and may not be
incorporated into any contract. CA assumes no responsibility for the accuracy or completeness
of the information. To the extent permitted by applicable law, CA provides this document “as
is” without warranty of any kind, including without limitation, any implied warranties or
merchantability, fitness for a particular purpose, or non-infringement. In no event will CA be
liable for any loss or damage, direct or indirect, from the use of this document, including,
without limitation, lost profits, lost investment, business interruption, goodwill, or lost data,
even if CA is expressly advised of the possibility of such damages.
3 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Agenda
> This session discusses the use of ESP Symbolic Variables
as they relate to:
Overview
Invocation of Variables and using Symbol Libraries
Built-in date Variables and using GENTIME
Global Variable Tables
Using Variables in Templates
4 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variables Overview
> ESP has powerful substitution capabilites using Symbolic
Variables enabling you to automate your workload while
making it easier to maintain
Save time by not having to code things such as dates each
time they are processed
Minimize errors by coding a variable once and have it
automatically resolved rather than coding a value each
time it is required
Reduce length of input data by using variables to
represent data such as the pathname to an executable
5 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variables Overview
> Symbolic Variables can be used almost anywhere in ESP
to enhance its flexibility and power, for example:
As part of jobname
In Events and User1,2,3,4 Variables of Events
As Agent name or Pathname to executable
As text of Argument fields being passed to executable
In JCL
In logical tests on CLANG statements
In Template definitions
In Global Variable Tables
In Job Documentation members
In Initialization Parameters
6 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variables Overview
> ESP provides an extensive set of Built-in Variables
Time based
Environment specific
Event related
ESP Procedure and Application based
> You can also create your own User-Defined variables and
assign specific values to them
> Percentage sign is default introducer character used to
reference the variables
7 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variables Overview
> Variables can be defined
directly within an Application
> Application-level variables
All jobs in the Application
can reference the
variables
APPL PAYROLL
JCLLIB ‘PROD.JCLLIB’
CYCLE=‘22’
PRFX=‘PROD’
JOB A
RELEASE B
RUN DAILY
JOB B
RELEASE C
RUN DAILY
JOB C
RUN DAILY
ENDJOB
8 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variables Overview
> Variables can be defined
directly within an Application
> Job-level variables
Variable can only be
referenced by the job in
which it is defined
Different jobs can use
different values for the same
variables Application can
reference the variables
APPL PAYROLL
JCLLIB ‘PROD.JCLLIB’
JOB A
CYCLE=‘22’
PRFX=‘PROD’
RELEASE B
RUN DAILY
JOB B
RELEASE C
RUN DAILY
JOB C
CYCLE=‘27’
PRFX=‘TEST’
RUN DAILY
ENDJOB
9 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Example of Variables Referenced by a Job
Built-in variables
ESPSDAY and ESPADAY
User-defined variable
NAME
Dataset containing value
of user-defined variables
Associated Job Definition
10 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Examples of Built-in Variables
11 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Storing and Retrieving Symbolic Variables
> Symbolic Variables can be defined and referenced directly
from within an ESP Procedure/Application
> Common practice is to store common variables in a PDS
member acting as a central repository
> You can retrieve variables from the repository in 3 ways:
INVOKE statement in an ESP Event
INVOKE statement in an ESP Procedure/Application
Symbolic Variable Library referenced in an Event
12 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
INVOKE Statement in an Event
EVENT ID(PROD.PAYROLL)
INVOKE ‘PROD.ESPPROC(PAYROLL)’
INVOKE ‘PROD.SYMLIB(SYMBOLS)’
ENDDEF
CYCLE=‘22’
PRFX=‘PROD’
BACKUP=‘NORMAL’
DATE1=‘%ESPSDD/%ESPSMM’
GENTIME XX TODAY LESS 3 DAYS
APPL PAYROLLJCLLIB ‘PROD.JCLLIB’JOB A
RUN DAILYRELEASE B
JOB BRUN DAILYRELEASE C
JOB CRUN DAILY
ENDJOB
13 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
APPL PAYROLLINVOKE ‘PROD.SYMLIB(SYMBOLS)’JCLLIB ‘PROD.JCLLIB’JOB A
RUN DAILYRELEASE B
JOB BRUN DAILYRELEASE C
JOB CRUN DAILY
ENDJOB
INVOKE Statement in an ESP ProcedureEVENT ID(PROD.PAYROLL)
INVOKE ‘PROD.ESPPROC(PAYROLL)’
ENDDEF
CYCLE=‘22’
PRFX=‘PROD’
BACKUP=‘NORMAL’
DATE1=‘%ESPSDD/%ESPSMM’
GENTIME XX TODAY LESS 3 DAYS
14 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variable Library in an Event
EVENT ID(PROD.PAYROLL)
INVOKE ‘PROD.ESPPROC(PAYROLL)’
SYMLIB SYMBOLS
ENDDEF
CYCLE=‘22’
PRFX=‘PROD’
BACKUP=‘NORMAL’
DATE1=‘%ESPSDD/%ESPSMM’
GENTIME XX TODAY LESS 3 DAYS
APPL PAYROLLJCLLIB ‘PROD.JCLLIB’JOB A
RUN DAILYRELEASE B
JOB BRUN DAILYRELEASE C
JOB CRUN DAILY
ENDJOB
15 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Symbolic Variable Library in an Event
> A Symbol Library must be defined in ESP before it can be
used
> DEFSYML command associates a logical identifier with the
actual dataset name
> The identifier is then referenced in the Event
DEFSYML SYMBOLS DA(‘PROD.SYMLIB(SYMBOLS)’)
16 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Differences between SYMLIB and INVOKE
> INVOKE supports conditional logic using If/Then/Else
> SYMLIBs must use %INCLUDE, %EXCLUDE statements
%INCLUDE IF (TODAY(‘FRI’) CYCLE = ‘99’BACKUP = ‘ALLDATA’
%ENDINCL EXCLUDE DAY(FRI)
BACKUP=‘NORMAL’%ENDEXCL
IF TODAY(‘FRI’) THEN DO
CYCLE = ‘99’
BACKUP = ‘ALLDATA’
ELSE BACKKUP = ‘NORMAL’
ENDDO
17 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Differences between SYMLIB and INVOKE
> If a symbol is assigned the value of another symbol that
does not exist, it will take on the literal value of that
symbol, (e.g. %ESPSDATE is mistyped as %EXPSDATE)
A = %EXPSDATE “A” will have value of “%EXPSDATE”
> Use FLAGUNDEF command in the SYMLIB to verify the
existance of the variable
In the above example, a Simulation would have flagged
%EXPSDATE as an error and it could be corrected to
%ESPSDATE
> Use FLAGUNDEF / ALLOWUNDEF to toggle this behavior
18 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Differences between SYMLIB and INVOKE
> A secured symbol is one that contains sensitive data,
such as a password and consequently requires additional
security
Value of the variable will not be displayed on Simulation,
in COPYJCL or as result of a SEND or VS command
> Use SECURE command in the SYMLIB to secure a
symbolic variable
PASSWORD = ‘MYPASSWORD’
SECURE PASSWORD //MYJOB JOB …,%PASSWORD,…
19 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Built-in Date Variables
> ESP provides an extensive set of built-in date and time
based variables
Naming standard consists of: introducer character, prefix
and descriptive name
%ESPADATE
Symbol Introducer
PrefixDescriptive Name
20 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Built-in Date Variables – Understanding Prefixes
> With built-in date variables the PREFIX forms a reference
point from which to resolve the variable
ESPA tells ESP to substitute the ACTUAL submission value
ESPS tells ESP to substitute the SCHEDULED value at the
time of processing
> Differences between the ACTUAL and SCHEDULED values
may occur due to factors such as system outages, or
executing an Event on a day other than its scheduled day
21 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Built-in Date Variables – Understanding Prefixes
Note date resolution
based on simulation date
Scheduled vs Actual
22 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Built-in Date Variables
Note: Same set of
Built-in Variables are
available with both
ESPA and ESPS
prefixes
23 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Built-in Date Variables used in JCL
> Use built-in symbolic variables to represent a date
parameter in JCL
> Substituted values on March 16, 2009
//PAYJOB1 JOB (………)//S1 EXEC PGM=GENRPTS,PARM=‘%ESPSMM%ESPSDD%ESPSYY’
//PAYJOB1 JOB (………)//S1 EXEC PGM=GENRPTS,PARM=‘031609’
24 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Generating Date and Time Variables
> Use the GENTIME command to generate customized date
and time symbolic variables that resolve to a date/time
reference other than the Actual or Scheduled date/time
> Store GENTIME commands in an ESP Procedure or
Symbol Library along with other symbolic variables
> Format of GENTIME command
GENTIME PREFIX SCHEDULE-CRITERIA
Prefix you assign
up to 8 characters
Not ESPA or ESPS
Any valid ESP
Scheduling Statement
GENTIME
Command
25 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Generating Date and Time Variables
ESPADATE ESPSDATE PREDATE
ESPAYY ESPSYY PREYY
ESPAYEAR ESPSYEAR PREYEAR
ESPAMM ESPSMM PREMM
ESPAMMM ESPSMMM PREMMM
ESPAMONTH ESPSMONTH PREMONTH
ESPADAY ESPSDAY PREDAY
ESPADD ESPSDD PREDD
ESPADDD ESPSDDD PREDDD
ESPADOW# ESPSDOW# PREDOW#
ESPATIME ESPSTIME PRETIME
ESPAHH ESPSHH PREHH
ESPAMN ESPSMN PREMN
ESPASS ESPSSS PRESS
26 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
GENTIME Examples
NT_JOB ACCTG002AGENT PROD_NTAGENTRUN LAST DAY OF QTRCMDNAME C:\PROD\BCKUP.EXEARGS 75 %PREDD%PREMM%PREYEAR
ENDJOB
If today is: Monday March 16th, 2009
Value is: 11032009
GENTIME PRE TODAY LESS 3 WORKDAYS
27 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
GENTIME Examples
Scheduling Criteria Prefix GENTIME Statement
7 days after today OVER GENTIME OVER TODAY PLUS 7 DAYS
2 workdays prior to today PPD GENTIME PPD TODAY LESS 2 WORKDAYS
Next workday ND GENTIME ND TODAY PLUS 1 WORKDAY
1st workday of current month
BGMNTH GENTIME BGMNTH 1ST DAY OF MONTH
STARTING TODAY
1st day of previous month PMNTH GENTIME PMNTH 1ST DAY OF MONTH
STARTING TODAY LESS 1 MONTH
1 week prior to today LW GENTIME LW TODAY LESS 1 WEEK
28 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Tables – What Are They?
> Global Variable tables store Symbolic Variables for global
use
Value of a variable can be set in one Application and
referenced and modified in another
> Can cause Event to trigger based on change in value of
variable
29 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Tables – When to Use Them?
> When variable values need to be changed programmatically
Can use CLANG, REXX or other means to alter a value
> When you need to schedule jobs based on a variable value
> When sharing variables across Applications
> To take action when value of a variable changes, for
example:
Trigger an Event using a Global Variable Trigger
Release job dependencies
Initiate Alert Processing
30 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Tables - Structure
> Structure:
Variable Table Name (Payroll, Accounting)
– Variable Name (Checknum, AcctingDate)
Variable Value (1234556, 02/31/02)
> Variable Table Names can be up to 8 characters long
> Variable Names can be up 64 characters in length
> Variable Values can be 255 characters in length
31 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Table Commands
> Commands are available to control Global Variable Tables
VTDEFINE – Define Global Variable Table
VTDELETE – Delete Global Variable Table
VTLIST – List Global Variable Table information
> Commands are available to control Global Variable Triggers
VTRDEFINE – Define a Global Variable Trigger
VTRDELETE – Delete a Global Variable Trigger
VTRLIST – List Global Variable Trigger information
32 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Table Commands
> Commands are available to control Global Variables
VPUT – Store a Global Variable in the Table
VGET – Retrieve a Global Variable from the Table
VINCR – Increment the numeric value of a Global Variable
VDEL – Delete a Global Variable from the Table
33 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
VTDEFINE Command
X530 --------------------------------------------------------ROW 1 COL 1
COMMAND ===>VTDEFINE GLOBAL1
---------------------------------- TOP OF DATA-----------------------
X530 ------------------------------------------------,Global Variable Table GL,
COMMAND ===>,
ESP1628I Global Variable Table GLOBAL1 defined ,
---------------------------------- TOP OF DATA---------------------------------
VTDEFINE GLOBAL1
34 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
VTLIST Command Example
X530 --------------------------------------------------------ROW 1 COL 1 ----
COMMAND ===>VTLIST -
---------------------------------- TOP OF DATA--------------------------------
X530 --------------------------------------------------------ROW 2 COL 1 ----
COMMAND ===>
VTLIST -
Global Variable Table GLOBAL1
Created at 11.11.12 on FRIDAY SEPTEMBER 25TH, 2009 by GLOBAL1
Last update at 11.11.12 on FRIDAY SEPTEMBER 25TH, 2009
Currently 2 variables, 0 triggers
Table size 440
FIRST='1113'
SECOND=THERE IS NOTHING YOU CANNOT DO WITH ESP'
35 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variables – Example 1
> The following example defines 2 variables and “PUTs”
them into a Global Variable Table
GENTIME PM LAST WORKDAY OF MONTH LESS 1 WORKDAY
PAYDATE = ‘%PPMM.%PPDD.%PPYY’PAYSTART = ’16.00’VPUT PAYDATE TABLE(PAYTABLE)VPUT PAYSTART TABLE(PAYTABLE)
36 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variables – Example 1
> An Application then “GETs” the variables from the Table
and they are referenced in the Job definition
APPL PAYROLL
VGET PAYDATE TABLE(PAYROLL)
VGET PAYSTART TABLE(PAYROLL)
JOB UPDATE1 RUN %PAYDATEEARLYSUB %PAYSTARTRELEASE CHKJOB
ENDJOB
JOB CHKJOBRUN %PAYDATE
ENDJOB
37 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variables – Example 2
> In this example a Job in an Application gets a variable
from a Table and a second Job increments the value of
the variable by 1
APPL STORE1
JOB PROCESS.DATARUN DAILYRELEASE STORE1.COMPLETEVGET STRCNT TABLE(STORE)
ENDJOB
JOB STORE1.COMPLETE LINK PROCESSRUN DAILYVINCR STRCNT TABLE(STORE)
ENDJOB
38 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variables – Example 2
> A Job in a subsequent Application retrieves the same
variable and processes it with the new (incremented)
value
APPL STORE2
JOB PROCESS.DATARUN DAILYVGET STRCNT TABLE(STORE)
ENDJOB
39 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variables – Example 3
> ESP considers all retrieved Global Variables as character
variables. If a Global Variable is numeric and you
anticipate doing calculations with it, you must declare it
as an integer before using the VGET command
JOB PROCESS.DATAINTEGER STRCNTVGET STRCNT TABLE(STORE)IF STRCNT > 250 THEN RUN TODAY
ENDJOB
40 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Triggers
> Global Variable Triggers are intended to Trigger an Event
when a designated Global Variable changes in value
> You can also make the trigger conditional on the value of
the variable
41 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Triggers - Defining
X530 --------------------------------------------------------ROW 1 COL 1 ----
COMMAND ===>VTRDEF VARIABLE(CLEANUP) table(ADMIN) event(PROD.ADMIN)
X530 --------------------------------------------------------ROW 1 COL 1 ----
COMMAND ===>VTRDEF VARIABLE(COUNT) table(ADMIN) event(PROD.REORG)when(‘100’)
Only trigger the Event once the variable COUNT
reaches 100
42 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global Variable Triggers - Displaying
X530 --------------------------------------------------------ROW 1 COL 1 -----
COMMAND ===>VTLIST ADMIN
,
---------------------------------- TOP OF DATA---------------------------------
VTLIST ADMIN
Global Variable Table ADMIN
Created at 10.38.50 on TUESDAY SEPTEMBER 29TH, 2009 by WOTST01
Last update at 10.49.19 on WEDNESDAY SEPTEMBER 30TH 2009
Currently 1 variable, 2 triggers
Table size 528
STORCNT=‘112'
VTRIG ID(0001) DefinedBy(WOTST01) Var(CLEANUP) Event(PROD.ADMIN)
VTRIG ID(0002) DefinedBy(WOTST01) Var(COUNT) When(‘100') Event(PROD.REORG)
43 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Global-Variable Tables built in Variables
Variable Description
ESPVTVARIABLE Specifies the name of the modified global variable
ESPVTTABLE Specifies the name of the global-variable table containing
modified global variable.
ESPVTOLDVALUE Specifies the value of the modified global variable prior
to modification.
ESPVTVALUE Specifies the value of the modified global variable after being
modified.
ESPVTUSER Specifies the user who made the modification.
44 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variable Triggers –Example 1
> In this example an Event is automatically Triggered once
a Global Variable reaches a certain value
VTRDEF VARIABLE(JOBCNT) TALBE(BACKUPS) EVENT(PROD.BACKUPS)
VSET JOBCNT 255 TABLE(JOBS)
JOB BAKCUP1
IF %ESPVTVARIABLE = ‘JOBCNT’ and %ESPVTVALUE = ‘255’ THEN DORUN TODAY
ENDDO
ENDJOB
VSET command changes the value of the variable
Event to be Triggered
45 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Working with Global Variable Triggers –Example 2
> In this example an Event is automatically Triggered once
any Global Variable in the specified Table is changed
VTRDEF VARIABLE(-) TALBE(BACKUPS) EVENT(PROD.BACKUPS)
46 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Templates
> A template is an element of CLANG you can use to
specify repetitive commands or statements that will be
referenced more than once
> Enables you to reuse statements for things such as
multiple job definitions, defining holidays etc.>
> Templates utilize Symbolic Variables to represent data
items
47 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Template Example
> In this example a Template
is used to define several
Jobs that have similar
attributes
All run Workdays
All have the same time
dependency
All execute the same
program
> Only the Jobname and Agent
name differ
TEMPLATE BACKUPS (2,JOBNAME,AGENT)
NT_JOB %JOBNAME
RUN WORKDAYS
EARLYSUB 4PM
CMDNAME C:\PGMS\BACKUP
AGENT %AGENT
ENDJOB
ENDTEMPL
BACKUPS CDRIVE AGENT1BACKUPS CDRIVE AGENT2BACKUPS EDRIVE AGENT5BACKUPS EDRIVE AGENT6
48 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Template Example
> This is the Application once
the Template has expanded
it and made the appropriate
symbolic substitution
NT_JOB CDRIVEAGENT AGENT1RUN WORKDAYSEARLYSUB 4PMCMDNAME C:\PGMS\BACKUP
ENDJOB
NT_JOB CDRIVEAGENT AGENT2RUN WORKDAYSEARLYSUB 4PMCMDNAME C:\PGMS\BACKUP
ENDJOB
NT_JOB EDRIVEAGENT AGENT5RUN WORKDAYSEARLYSUB 4PMCMDNAME C:\PGMS\BACKUP
ENDJOB
NT_JOB EDRIVEAGENT AGENT6RUN WORKDAYSEARLYSUB 4PMCMDNAME C:\PGMS\BACKUP
ENDJOB
49 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA
Summary
> In this session we have discussed some of the many uses of
Symbolic Variables:
Differences between Invocation of dataset containing
variables vs using a Symbol Library to reference the dataset
Using GENTIME to create customized date/time variables
Overview of Global Variable Tables
Using Variables in a Template
50 October 12, 2009 Working with ESP WA Variables Copyright © 2009 CA