Get variables of datasets for ESP MULTIPLE DSTRIG Event
search cancel

Get variables of datasets for ESP MULTIPLE DSTRIG Event

book

Article ID: 55403

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

Using the following Event definition as an example:

EVENT ID(CYB.TESTDSN)  
INVOKE 'hlq.ESP.PROCLIB(TESTDSN)'       
DSTRIG 'PROD.FILE1.G-' JOB(TESTJOB1) MULTIPLE      
DSTRIG 'PROD.FILE2.G-' JOB(TESTJOB2) MULTIPLE      
ENDDEF

Coding MULTIPLE on each DSTRIG command indicates that this Event is not triggered until both of the following criteria have been met:

TESTJOB1 creates a generation of PROD.FILE1.

TESTJOB2 creates a generation of PROD.FILE2.

%ESPTRDSN provided by ESP, in this case, contains the name of the last created file, in this case either TESTJOB1 or TESTJOB2.

Is there a way to reference variables of two datasets referenced in the MULTIPLE dataset triggering event where first variable reflect the PRIMED dataset name.

 

Environment

Component: ESP WORKLOAD AUTOMATION
Release:   12.0

Resolution

Implement with global symbolic variable ESPTRDSN1 and ESPTRDSN2 by using the Global Variable Table utility as described below:

#1 Define a Global Variable Table.
VTDEFINE MYTAB

#2 In addition to event hlq.TESTDSN above, create another two separate DSTRIG events:
EVENT ID(CYB.TESTDSN1)  
INVOKE 'hlq.ESP.PROCLIB(TESTDSN1)'       
DSTRIG 'PROD.FILE1.G-' JOB(TESTJOB1) ANYCLOSE      
ENDDEF

EVENT ID(CYB.TESTDSN2)  
INVOKE 'hlq.ESP.PROCLIB(TESTDSN2)'       
DSTRIG 'PROD.FILE2.G-' JOB(TESTJOB2) ANYCLOSE      
ENDDEF

Where TESTDSN1 and TESTDSN2 are a simple one line ESP procedures:
BROWSE   hlq.ESP.PROCLIB(TESTDSN1) 
Command ===>                        
********************************* Top of Data *****
VSET ESPTRDSN1 %ESPTRDSN TABLE(MYTAB)              
******************************** Bottom of Data ***

BROWSE   hlq.ESP.PROCLIB(TESTDSN2) 
Command ===>                        
********************************* Top of Data *****
VSET ESPTRDSN2 %ESPTRDSN TABLE(MYTAB)              
******************************** Bottom of Data ***

#3 Upon the completion of steps 1 and 2, the following code placed in hlq.ESP.PROCLIB(TESTDSN) will generate the required file name reference:
ESPTRDSN1 = ''                                 
ESPTRDSN2 = ''                                 
N = '1'                                        
IF SUBSTR(10,1,%ESPTRDSN) = '1' THEN N = '2'   
ESPTRD = 'ESPTRDSN%N'                          
VGET %ESPTRD TABLE(MYTAB)                      
ESPTRD = '%ESPTRDSN1%ESPTRDSN2'                
SE 'ESPTRDSN1 = %ESPTRD' U(*)                  
SE 'ESPTRDSN2 = %ESPTRDSN' U(*)

NOTE: The last fragment of the code above, shows the ability of 'second level of variable substitution'. Or in the other words, allow us to get the value of the variable, when the name of this variable is a variable itself.