%INCLUDE and %EXCLUDE in JCL not validated properly with ESP CALENDAR in ESP Proc
search cancel

%INCLUDE and %EXCLUDE in JCL not validated properly with ESP CALENDAR in ESP Proc

book

Article ID: 258421

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

When ESP CALENDAR is used to specify a calendar on APPL level, the %INCLUDE and %EXCLUDE conditions are not validated properly.

Define two calendars with different workdays:
listcal TEST-                                               
TEST: use default workdays Mon-Fri                           

ESP Proc:
APPL TEST06                                        
JCLLIB 'ESP.JCLLIB'                        
ESP CALENDAR TESTSAT                               
JOB CYBJOB.1                                        
 RUN LAST WORKDAY OF MONTH                         
ENDJOB                                             
ESP CALENDAR TEST                                  
JOB CYBJOB.2                                        
 RUN LAST WORKDAY OF MONTH                         
ENDJOB         

My JCL:
ESP.JCLLIB(CYBER)

%INCLUDE IF(TODAY('LAST DAY OF MONTH'))
//S0 EXEC PGM=IEFBR14  
%ENDINCL     

When I simulate/trigger the related event for Dec 31 2022, JOB CYBJOB.1 is selected, however step S0 is not included.


               

Environment

Component: ESP Workload Automation

Release : 12.0

Resolution

This is indeed a limitation on ESP side. The ESP CALENDAR command inside a procedure sets a new calendar and replaces the previous one. Since the JCL is processed only after the whole application has been read in, the calendar in the last ESP CALENDAR command is used to evaluate the time criteria in the %INCLUDE statement. The design of %INCLUDE/%EXCLUDE processing does not account for dynamically changing calendars inside the procedure, 

Following is a workaround:
APPL ...
ESP CALENDAR xxxx
JOB TEST1
  IF TODAY('LAST WORKDAY OF MONTH') THEN LASTDAY=1
....
ENDJOB

In the JCL:

%INCLUDE IF (LASTDAY=1)  
//S0  EXEC PGM=IEFBR14
%ENDINCL