Is there a way to reference, through variables such as ESPTRDSN1 and ESPTRDSN2, any of the two datasets referenced in the MULTIPLE dataset triggering event? Where variable ESPTRDSN1 would always reflect the PRIMED dataset name.

Document ID : KB000055403
Last Modified Date : 14/02/2018
Show Technical Document Details

Using the following Event definition as an example:

EVENT ID(CYB.TESTDSN)  
INVOKE 'CYB.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:

  1. TESTJOB1 creates a generation of PROD.FILE1.

  2. 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.

We can implement and support our own 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 CYB.TESTDSN above, create another two separate DSTRIG events:
    EVENT ID(CYB.TESTDSN1)  
    INVOKE 'CYB.ESP.PROCLIB(TESTDSN1)'       
    DSTRIG 'PROD.FILE1.G-' JOB(TESTJOB1) ANYCLOSE      
    ENDDEF
    EVENT ID(CYB.TESTDSN2) INVOKE 'CYB.ESP.PROCLIB(TESTDSN2)' DSTRIG 'PROD.FILE2.G-' JOB(TESTJOB2) ANYCLOSE ENDDEF
    where TESTDSN1 and TESTDSN2 are a simple one line ESP procedures:
    BROWSE CYB.ESP.PROCLIB(TESTDSN1) Command ===> ********************************* Top of Data ***** VSET ESPTRDSN1 %ESPTRDSN TABLE(MYTAB) ******************************** Bottom of Data ***
    BROWSE CYB.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 CYB.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.

This Frequently Asked Question applies to all supported releases of ESP Workload Manager.