Schedule JOBs only when the same file received 3 times in a day with ESP Workload Automation
search cancel

Schedule JOBs only when the same file received 3 times in a day with ESP Workload Automation

book

Article ID: 279209

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

We have a requirement to trigger an application based on WOB Trigger which needs to trigger the application only when the same file is received 3 times in a day. 

Environment

ESP Workload Automation 12.0 and above

Resolution

Solution using global variables

#1 Define the global variable table with VTDEFINE:

VTDEFINE LUCY

#2 Define initial values for the global variables:
vset FILECOUNT 0 table(LUCY)
vset FILEDATE '240212' table(LUCY)

#3 Add something like below in the ESP Proc, before the APPL statement:
Note: add them before APPL can avoid creating a new generation when the requirement doesn't meet; and you can set up a test Proc to experiment the IF logics.

IF ESP_APPL_GEN THEN                  
DO                                    
VGET FILEDATE TABLE(LUCY)             
VGET FILECOUNT TABLE(LUCY)            
TTODAY='%ESPSYY%ESPSMM%ESPSDD'        
IF %FILEDATE NE %TTODAY  THEN DO      
  VSET FILEDATE '%TTODAY' TABLE(LUCY) 
  VSET FILECOUNT 1 TABLE(LUCY)        
  EXIT                                
ENDDO                                 
VINCR FILECOUNT TABLE(LUCY)           
IF %FILECOUNT NE '3' THEN EXIT        
ENDDO        

APPL ....

Solution using FILE_TRIGGERs in ESP Proc instead of WOBTRIG in the event

  - In event, add SCHEDULE 00.00 DAILY to schedule the event daily;
  - In ESP Proc, define 3 FILE_TRIGGERs thru the use of TEMPLATE to avoid the duplication:
      TEMPLATE FILTR (1,JOBNAME)
        FILE_TRIGGER %JOBNAME
         ...............
        ENDJOB
       ENDTEMPL
      FILTR  FILETRIG1
      FILTR  FILETRIG2
      FILTR  FILETRIG3
    - In the ESP Proc, add a LINK PROCESS, so that the current generation will be force completed at the end of the day:
      JOB END CONDITIONAL
         ...........
         DELAYSUB 23.59
         ESPNOMSG AJ   ..... <AJ to force complete the current appl.gen>
       ENDJOB

Additional Information

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/reference/commands/vtdefine-command-define-global-variable-tables.html

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/reference/commands/vset-command-set-global-variables.html