ESP dSeries Workload Automation

 View Only
Expand all | Collapse all

Suspend/Resume with multiple criteria

  • 1.  Suspend/Resume with multiple criteria

    Posted Jul 28, 2022 04:27 PM
    Hello,

    One of our applications has an event that they want to run as follows:

    • Run hourly on workdays from 06:00 through 18:00.
    • Run hourly on THANKSGIVING_DAY2 (defined to the SYSTEM calendar as a holiday) from 06:00 through 18:00.
    • Run hourly on CHRISTMAS_EVE (defined to the SYSTEM calendar as a holiday) from 06:00 through 18:00.
    We know we can set these up and run them as 3 events (ie workdays, THANKSGIVING_DAY2, and CHRISTMAS_EVE) with appropriate suspend/resume criteria but was wondering if there's any way to do this in 1 event.

    We did try things like the following but they didn't work
    • Suspend:  18:30 THANKSGIVING_DAY2 CHRISTMAS_EVE workdays
    • Resume:  05:30 THANKSGIVING_DAY2 CHRISTMAS_EVE workdays
    We also tried using THANKSGIVING_DAY2 alone in the RESUME but it didn't work.

    Does anyone have ideas on how to accomplish what we want with a single event or do we need to set up 3 separate ones to cover all of these situations?

    Thanks,
    Donna Domovic


  • 2.  RE: Suspend/Resume with multiple criteria

    Broadcom Employee
    Posted Jul 29, 2022 01:49 AM
    Hi,

    Can you try this -




    Schedule : workdays hourly
    Schedule : hourly starting 6am thanks_giving
    Schedule: hourly starting 6am xmas

    Suspend:18:01
    Resume:05:59

    Hope it helps!
    Ravi Kiran


  • 3.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 10:28 AM
    Ravi,

    Thanks for suggesting this.  I gave it a try and it gets us close ot quite there.

    I have the following:


    Schedule:  workdays hourly
    Schedule:  hourly starting 06:00 THANKSGIVING_DAY2
    Schedule:  hourly starting 06:00 CHRISTMAS_EVE

    Suspend:  18:30
    Resume:  05:30

    The Suspend/Resume criteria as far as time of day is being honored throughout which is good but after THANKSGIVING_DAY2, it starts running on Saturday and Sundays as well.  Below are a few screen shots from before and after THANKSGIVING_DAY 2 (ie 11/25/2022).

    Before THANKSGIVING_DAY2:


    After THANKSGIVING_DAY2:


    We're continuing to play with this and the other responses but welcome any ideas you have.

    Thanks,
    Donna


  • 4.  RE: Suspend/Resume with multiple criteria

    Broadcom Employee
    Posted Aug 01, 2022 07:32 AM
    Hi,

    OK. Got the problem with my previous schedule.


    Schedule:  workdays hourly
    Schedule:  THANKSGIVING_DAY2 5am plus 60 minutes
    Schedule:  THANKSGIVING_DAY2 6am plus 60 minutes

    Schedule:  CHRISTMAS_EVE 5am plus 60 minutes
    Schedule:  CHRISTMAS_EVE 6am plus 60 minutes

    Suspend:  18:30
    Resume:  05:30

    Now , it will trigger on holidays at 6am ,7am and it will not trigger on weekends.
    If this works , you can add 7am plus 60 minutes , 8am plus 60 minutes ,.... so on for the schedules and this should keep getting more hours for the holidays.

    Hope it helps!
    -Ravi Kiran


  • 5.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 07:38 AM
    This sounds like something you would to do in the Application and not the EVENT. With scenarios like this we create a RUNME variable and add it into the job.

    Someone may be able to give an exact example, but I have a few I found that are working in our environment. Maybe you can tweak them for your scenario.

    Run based on time and day:
    APPL.RUN7='FALSE';
    if ((APPL._SHH =='07' && APPL._SMN == '30') && ( today('Monday'))) APPL.RUN7='TRUE';

    Run based on a calendar:
    APPL.RUNME = 'FALSE';
    if (today('FISDAY5')) APPL.RUNME='TRUE';

    Run between 7am and 11 am:
    APPL.RUNME7AM='FALSE';
    if (APPL._SHH == '07' || APPL._SHH == '08' || APPL._SHH == '09' || APPL._SHH == '10' || APPL._SHH == '11') APPL.RUNME7AM='TRUE';

    In this doc link there are many examples of how to schedule based on dates, month etc. On page 12 there is one that schedules based on day and day of month (below).

    https://ftpdocs.broadcom.com/cadocs/q0/q000771e.pdf


    Objective
    Run a job on the last Saturday of the month, provided this date falls on the 26th
    through to the 31st day of the month. Otherwise, run the job on the following
    Saturday (in other words, the first Saturday of the next month).

    Solution
    Use the following JavaScript script at Event trigger time for the job:
    WOB.runme=false;
    genTime('lw','today less 1 week');
    if (today('last saturday of month') && APPL._SDD > '25')
    WOB.runme=true;
    if (today('first saturday of month') && lwDD < '26')
    WOB.runme=true;

    Use the %WOB.runme variable as the run frequency in the job definition.


    ------------------------------
    DARDEN Corporation
    Orlando, FL
    ------------------------------



  • 6.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 11:42 AM
    Kenneth,

    Thanks for this information and the link you provided.  We'll take a look and have used Java scripts for things within the applications to select jobs.  Didn't think about using it at the Event level.  Nice to know we can do that if needed.

    That link you provided was great!

    Donna


  • 7.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 02:06 PM
    I'm thinking javascript is going to be the solution. I'm just not that proficient at multiple decisions within an IF statement. I would imagine it would be something like:

    WOB.runme='false';
    if today('workday') || (today('last thursday November') || today('25th December') && APPL._SHH == '6' WOB.runme=true;
    WOB.runme='true';

    ------------------------------
    DARDEN Corporation
    Orlando, FL
    ------------------------------



  • 8.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 02:58 PM
    I think the JavaScript might work but we were hoping we could put it in the Event instead of the Application.  I was thinking it would be clearer and easier to track if we assigned the JavaScript to the Event instead of the Application.  The problem I'm running into is that I don't know how to use the WOB.runme variable in the Schedule criteria.  I've tried %WOB.runme, %(WOB.runme), WOB.runme, and am playing with other combinations/options but doesn't seem to work.  Gets an error when saving the Event.

    Do you know if there's a way to supply a variable as part of the Event Schedule criteria?

    Thanks,
    Donna Domovic


  • 9.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 03:40 PM
    Here is what I have and it seems to be working to me, but not sure if it matches what you have setup. We're close ha!

    APPL.runme='false';
    if (today('workdays') || today('last thursday November') || today('25th December'))
    APPL.runme='true';


    ------------------------------
    DARDEN Corporation
    Orlando, FL
    ------------------------------



  • 10.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 04:08 PM
    Kenneth,

    Thanks.  It's a little bit different than what I was thinking but might be the best option if we want to use the JavaScript.  Looks like if we do, the runme variable would be used within the Application run statement rather than the Event schedule statement.  

    We'll have to think about it and see what we want to do.  We're also considering using a RETRIG within the application.

    Between all of the options you and everyone has thrown out, we should be able to find something that will work for us.

    Thanks,
    Donna Domovic


  • 11.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 10:52 AM
    Edited by SHARON SHIMANEK Jul 29, 2022 10:58 AM
    I have been having fun trying to figure this out too, 
    • Run hourly on workdays  
    • Run hourly starting at 6am THANKSGIVING_DAY2 ending at 6:01pm THANKSGIVING_DAY2
    • Run hourly starting at 6am CHRISTMAS_EVE ending at 6:01pm CHRISTMAS_EVE
    leave suspend 6:01pm
             resume 5:55am

    I noticed with this it continued to run sat/sun.  This is due to the starting on thanksgiving with no end.
    Schedule : workdays hourly
    Schedule : hourly starting 6am thanks_giving
    Schedule: hourly starting 6am xmas

    However, adding the ending at seems to work for this year but didn't seem to carry through for holidays of 2023 so might be something to check on next year  I know there is something about jobs that run every x min or hours and calculating next scheduled run when to much time has passed  like from christmaseve 2022 to thanksgiving 2023.  So i would monitor this and maybe and do list scheduled events to verify.  Worst case I think Nov of 2023 you could refresh the event, I know that isn't ideal.  If I come up with anything else Iwill let you know.  

    Sharon



  • 12.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 11:50 AM
    Hi Sharon,
    I worried that it would only run for the 2022 THANKSGIVING_DAY2.
    I defined two holidays:
    HOLIDAY_DAY0 with dates Aug 3 2022 & Aug 9 2022
    HOLIDAY_DAY1 with dates Aug 4 2022 & Aug 18 2022.

    I set up the event to run on workdays and HOLIDAY_DAY1:
    Every 6 hours Workdays starting 9:00
    Every 6 hours starting 9:00 HOLIDAY_DAY1 ending 21:00 HOLIDAY_DAY1
    Suspend at 21:00
    Resume at 9:00

    It did not run on the dates for HOLIDAY_DAY0 (Aug 3rd and Aug 19th).
    It did run on the first date for HOLIDAY_DAY1  Aug 4th but it did not run the second date for HOLIDAY_DAY1 Aug 18th.
    Apparently the starting and ending statement will only work for 1 date range.
    Thank you!


  • 13.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 01:12 PM
    Hi Kelly
    Is HOLIDAY_DAY0 and HOLIDAY_DAY1 the actual calendar name or the holiday names within the calendar?  My run statements used the holiday name inside the holiday calendar.




  • 14.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 01:46 PM
    I have a Calendar named KELLYCAL with the days below defined as holidays.

    HOLIDAY_DAY0 Aug 3 2022
    HOLIDAY_DAY1 Aug 4 2022
    HOLIDAY_DAY0 Aug 18 2022
    HOLIDAY_DAY1 Aug 19 2022

    I wanted to test that the code would work for the second HOLIDAY_DAY1 (Aug 19) but it didn't.
    It did work for the first HOLIDAY_DAY1 (Aug 4).

    Kelly Sanchez
    TechOps-Mainframe Operations
    Work 779-231-1022
    Cell 815-210-8801




  • 15.  RE: Suspend/Resume with multiple criteria

    Posted Jul 29, 2022 01:54 PM
    Ah, all my holiday dates are for 1 day.