ESP Workload Automation

  • 1.  Need help scheduling a job!

    Posted Jun 22, 2012 04:01 PM
    I have a user that wants to run JobA on Fridays unless a holiday falls during the week. If a holiday falls during the week she doesnt want to run JobA she wants to run JobB instead on the friday and if the holiday happens to fall on Friday she wants to run the JobB job on Thursday.

    I'm overthinking this but having probs. Any suggestions?
    Thanks!
    Kathy


  • 2.  RE: Need help scheduling a job!

    Posted Jun 22, 2012 04:46 PM

    Kmullin wrote:

    I have a user that wants to run JobA on Fridays unless a holiday falls during the week. If a holiday falls during the week she doesnt want to run JobA she wants to run JobB instead on the friday and if the holiday happens to fall on Friday she wants to run the JobB job on Thursday.

    I'm overthinking this but having probs. Any suggestions?
    Thanks!
    Kathy
    What do you want to do on something like Thanksgiving which always occurs on a Thursday ?

    Also several employers (unfortunately not all) also give the Friday after Thanksgiving as a holiday as well. How do you want to handle that ? Do you want to schedule jobA or jobB or Wednesday ?

    And in 2015 you find that Christmas Eve is on a Thursday and Christmas Day is on a Friday and both days are holidays for most people. How do you want to schedule jobA and jobB in this scenario ?

    I think the questions above need to be answered before you delve any further.

    Regards

    Michael E. Ellis
    Systems Programmer
    Deere & Company


  • 3.  RE: Need help scheduling a job!

    Posted Jun 22, 2012 05:32 PM
    If its a 5 day week (no holiday) JobA needs to run on friday
    if its a 4 day week (holiday) JobB needs to run instead of JobA. If the holiday is on Mon, Tue, Wed, or Thu - JobB should run on Friday. If the holiday falls on Friday JobB should run on Thu.

    We work at a bank so we cant have day after thanksgiving or Christmas eve off as a holiday here.

    Thank you for your help..
    Kathy


  • 4.  RE: [CA Workload Automation ESP Edition] RE: Need help scheduling a job!

    Posted Jun 23, 2012 11:01 AM
    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


  • 5.  RE: [CA Workload Automation ESP Edition] RE: Need help scheduling a job!

    Posted Jun 27, 2012 11:31 AM
    A minor change to the solution. Add a NORUN TODAY to JOB B.

    JOB B
    NORUN TODAY
    <rest of job definition from above>

    Without this JOB B seems to show up on days it is not wanted. I have now simulated this on various holidays. I used July 4th to test a "moving" holiday out in 2014 (Friday) and 2015 (Saturday, moved to Friday) and everything seems to work. Technically the FRB does not move holidays which fall on Saturday but I wanted to test a moved holiday.

    Gene


  • 6.  RE: Need help scheduling a job!

    Posted Jul 13, 2012 12:20 PM
    How about something like this?
    When a week has 5 workdays, run Job A on the last workday of the week, otherwise, run Job B on the last workday of the week.

    JOB A
    RUN 5TH WORKDAY OF WEEK
    ENDJOB

    JOB B
    RUN LAST WORKDAY OF WEEK
    NORUN 5TH WORKDAY OF WEEK
    ENDJOB


  • 7.  RE: Need help scheduling a job!

    Posted Jul 13, 2012 12:33 PM
    Seems simpler (which is better) but my concern the use of the OF keyword. I would use WITHIN. THE 30TH DAY OF FEBRUARY is March 2nd. The 30TH DAY WITHIN FEBRUARY doesn't exist.

    For WORKDAYS, notice the beginning of September.

    TEST (15) 5TH WORKDAY OF WEEK
    00.00.00 FRIDAY JULY 13TH, 2012, DAY 195
    00.00.00 FRIDAY JULY 20TH, 2012, DAY 202
    00.00.00 FRIDAY JULY 27TH, 2012, DAY 209
    00.00.00 FRIDAY AUGUST 3RD, 2012, DAY 216
    00.00.00 FRIDAY AUGUST 10TH, 2012, DAY 223
    00.00.00 FRIDAY AUGUST 17TH, 2012, DAY 230
    00.00.00 FRIDAY AUGUST 24TH, 2012, DAY 237
    00.00.00 FRIDAY AUGUST 31ST, 2012, DAY 244
    00.00.00 MONDAY SEPTEMBER 10TH, 2012, DAY 254
    00.00.00 FRIDAY SEPTEMBER 14TH, 2012, DAY 258
    00.00.00 FRIDAY SEPTEMBER 21ST, 2012, DAY 265
    00.00.00 FRIDAY SEPTEMBER 28TH, 2012, DAY 272
    00.00.00 FRIDAY OCTOBER 5TH, 2012, DAY 279
    00.00.00 MONDAY OCTOBER 15TH, 2012, DAY 289
    00.00.00 FRIDAY OCTOBER 19TH, 2012, DAY 293

    Using WITHIN avoids the roll to the next week.

    TEST (15) 5TH WORKDAY WITHIN WEEK
    00.00.00 FRIDAY JULY 13TH, 2012, DAY 195
    00.00.00 FRIDAY JULY 20TH, 2012, DAY 202
    00.00.00 FRIDAY JULY 27TH, 2012, DAY 209
    00.00.00 FRIDAY AUGUST 3RD, 2012, DAY 216
    00.00.00 FRIDAY AUGUST 10TH, 2012, DAY 223
    00.00.00 FRIDAY AUGUST 17TH, 2012, DAY 230
    00.00.00 FRIDAY AUGUST 24TH, 2012, DAY 237
    00.00.00 FRIDAY AUGUST 31ST, 2012, DAY 244
    00.00.00 FRIDAY SEPTEMBER 14TH, 2012, DAY 258
    00.00.00 FRIDAY SEPTEMBER 21ST, 2012, DAY 265
    00.00.00 FRIDAY SEPTEMBER 28TH, 2012, DAY 272
    00.00.00 FRIDAY OCTOBER 5TH, 2012, DAY 279
    00.00.00 FRIDAY OCTOBER 19TH, 2012, DAY 293
    00.00.00 FRIDAY OCTOBER 26TH, 2012, DAY 300
    00.00.00 FRIDAY NOVEMBER 2ND, 2012, DAY 307


  • 8.  RE: Need help scheduling a job!

    Posted Jul 13, 2012 05:24 PM
    I typically use the 'Test Schedule Criteria' function as a quick way to find test dates to use when simulating a schedule.
    However, when it comes to the actual schedule criteria, the results returned by 'Test Schedule Criteria', can be inconsistent with how our schedules end up running in production.
    The simulations seem to do a better job of predicting when our jobs are going to run, so we rely more on those.

    In this case, I don't think you need the WITHIN, but it doesn't hurt, and is probably more correct.
    The OF is more consistent with the language on our schedule request forms, so it tends to be our default.
    We only use WITHIN when we have to, which, so far, has only been with GENTIME.

    For example, when I resolved 5TH WORKDAY OF WEEK with 'Test Schedule Criteria', I got the same results you did (Sept. 10th listed as 5th workday, etc.).
    However, when I simulate my test jobs that use 5TH WORKDAY OF WEEK in the schedule criteria, I get the correct results.
    Meaning...only JOBB is scheduled on Sept. 7th, neither job is scheduled on Sept. 10, and only JOBA is scheduled on Sept. 14.
    i get the same results when I run the simulations using WITHIN, which is why I say that it may be more 'correct'.

    I've always wondered whether the way the dates get resolved for 'Test Schedule Criteria' and Simulate are actually different, or if we just have some kind of configuration quirk.
    I'd be curious to know if your simulation matches the results you get with 'Test Schedule Criteria'.
    Did you happen to run a simulation when you tested 5TH DAY OF WEEK?
    If not, please don't go out of your way to run one. It's not really an issue for us, I'm just curios.

    __________________________________
    Simulation of Friday Sept. 7
    __________________________________

    INVOKE CATEST.APPLLIB(#TEST)
    APPL TEST POST_OLDEST
    OPTIONS NOINHERIT
    /*
    JCLLIB 'CATEST.JCL'
    COPYJCL 'CATEST.COPYJCL'
    TEMPLIB 'CATEST.TEMPLIB'
    /*
    JOB JOBA
    RUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    JOB JOBB
    RUN LAST WORKDAY OF WEEK
    NORUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    SIMULATION OF EVENT HSLAI00.TEST AT 00.00.00 ON FRIDAY SEPTEMBER 7TH, 2012
    JOBS: JOBB
    1 JOB SELECTED FOR SUBMISSION

    JOB TYPE-JOBNAME---HC-RELEASES
    JOB JOBB 0 (NONE)

    __________________________________
    Simulation of Monday Sept. 10
    __________________________________

    INVOKE CATEST.APPLLIB(#TEST)
    APPL TEST POST_OLDEST
    OPTIONS NOINHERIT
    /*
    JCLLIB 'CATEST.JCL'
    COPYJCL 'CATEST.COPYJCL'
    TEMPLIB 'CATEST.TEMPLIB'
    /*
    JOB JOBA
    RUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    JOB JOBB
    RUN LAST WORKDAY OF WEEK
    NORUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    SIMULATION OF EVENT CATEST.TEST AT 00.00.00 ON MONDAY SEPTEMBER 10TH, 2012
    JOBS: (NONE)
    NO JOBS SELECTED FOR SUBMISSION

    JOB TYPE-JOBNAME---HC-RELEASES

    __________________________________
    Simulation of Friday Sept. 14
    __________________________________

    INVOKE CATEST.APPLLIB(#TEST)
    APPL TEST POST_OLDEST
    OPTIONS NOINHERIT
    /*
    JCLLIB 'CATEST.JCL'
    COPYJCL 'CATEST.COPYJCL'
    TEMPLIB 'CATEST.TEMPLIB'
    /*
    JOB JOBA
    RUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    JOB JOBB
    RUN LAST WORKDAY OF WEEK
    NORUN 5TH WORKDAY OF WEEK
    ENDJOB
    /*
    SIMULATION OF EVENT CATEST.TEST AT 00.00.00 ON FRIDAY SEPTEMBER 14TH, 2012
    JOBS: JOBA
    1 JOB SELECTED FOR SUBMISSION

    JOB TYPE-JOBNAME---HC-RELEASES
    JOB JOBA 0 (NONE)


  • 9.  RE: Need help scheduling a job!

    Broadcom Employee
    Posted Jul 18, 2012 08:50 AM
    Hello,

    The following knowledge document explains the difference between "SIMULATION" and "EVENT-->NEXT":
    -------
    Document ID: TEC474998
    Tech Document
    Title: The difference between "SIMULATION" and "EVENT-->NEXT"


    Description:
    The event has "SCHED WORKDAYS" coded, but when I simulate it with this coming Saturday I still see JOBs showing in the simulation output. What's wrong? How do I verify the SCHED statements are correct?

    Solution:
    The "EVENTS --> NEXT" (from ESP WA main panel, E.5) is the best way to check schedule criteria in the EVENT definition.

    And SIMULATION is mostly used to check schedule criteria in APPL or JOB. When we use SIMULATION, it simulates the event regardless of SCHEDULE, NOSCHED or other schedule criteria.
    -----

    Lucy