I think this handles your requirements but I haven’t coded it in my system and simulated it for various conditions. This solution uses the DAYS_BETWEEN function to test the number of workdays in the week. It also adjusts JOB B to run on Thursday if the holiday is Friday.
The only condition I can see where this would not work is when both Thursday and Friday are holidays. The NORUN HOLIDAY in JOB B would prevent either run but you said this is a banking environment so the Federal Reserve won't let that happen.
Let us know if it does everything you needed.
JOB A
/* RUN ON FRIDAY
RUN FRIDAY
/* IF THIS IS A HOLIDAY SHORTENED WEEK THEN DO NOT RUN THIS JOB.
/* TEST FOR A HOLIDAY SHORTENED WEEK BY TESTING THE NUMBER OF
/* WORKDAYS THAT OCCURRED IN THE LAST 5 DAYS. WE USE A RANGE OF
/* THAT INCLUDES TOMORROW BECAUSE THE DAYS_BETWEEN FUNCTION
/* COVERS "UP TO BUT NOT INCLUDING" THE SECOND DATE VALUE.
/* DAYS_BETWEEN() IS DOCUMENTED IN THE USER'S GUIDE, PAGE 159.
IF TODAY('FRIDAY') AND -
DAYS_BETWEEN('TODAY LESS 5 DAYS','TOMORROW','WORKDAYS') -
LT 5 THEN NORUN TODAY
ENDJOB
JOB B
/* IF HOLIDAY OCCURS DURING THE WEEK THEN THIS JOB IS RUN
/* INSTEAD OF JOB A. IF THE HOLIDAY FALLS ON FRIDAY THEN
/* RUN THIS JOB ON THURSDAY.
IF TODAY('THURSDAY') AND TOMORROW('HOLIDAY') THEN RUN TODAY
/* TEST FOR A MONDAY THROUGH THURSDAY HOLIDAY BY CHECKING
/* THE NUMBER OF WORKDAYS IN THE WEEK. IF LESS THAN 4 THEN
/* RUN THIS JOB.
IF TODAY('FRIDAY') AND -
DAYS_BETWEEN('TODAY LESS 5 DAYS','TODAY','WORKDAYS') LT 4 THEN -
RUN TODAY
/* IF THE HOLIDAY FALLS ON FRIDAY WE RAN THIS JOB YESTERDAY.
/* MAKE SURE THE JOB DOES NOT RUN TODAY. THIS CONDITION
/* SHOULDN'T PASS THE ABOVE TEST BUT THIS IS CODED TO BE
/* SURE.
NORUN HOLIDAY
ENDJOB
Gene Budbill
Associate Engineering Services Architect
CA Technologies
From: CA Workload Automation (Mainframe) Global User Community [mailto:
CommunityAdmin@communities-mail.ca.com]
Sent: Friday, June 22, 2012 5:32 PM
To:
mb.2271275.98376205@myca-email.ca.com
Subject: [CA Workload Automation ESP Edition] RE: Need help scheduling a job!
If it's a 5 day week (no holiday) Job A needs to run on Friday
if it's a 4 day week (holiday) Job B needs to run instead of Job A. If the holiday is on Mon, Tue, Wed, or Thu - Job B should run on Friday. If the holiday falls on Friday Job B should run on Thu.
We work at a bank so we can't have day after thanksgiving or Christmas eve off as a holiday here.
Thank you for your help..
Kathy
Posted by:Kmullin
--
CA Communities Message Boards
98378745
mb.2271275.98376205@myca-email.ca.com