CA Workload Automation ESP Edition

Expand all | Collapse all

NORUN TODAY after specified date

Jump to Best Answer
  • 1.  NORUN TODAY after specified date

    Posted 04-06-2020 01:11 PM
    I have a job that should not execute after a certain date in the future. I want to add a statement now, so I don't have to touch the job when that date arrives.
    Is this idea possible using syntax similar to what I  am using in this example? My attempts with statements to get the job to bypass today are not working.

    LINUX_JOB DATE_TEST
    RUN WEEKDAYS
    IF '%ESPSMM%ESPSDD%ESPSYEAR' GT '03012020' THEN NORUN TODAY
    cmdname date
    USER user1
    AGENT agent1
    ENDJOB

    ------------------------------
    Cigna
    ------------------------------


  • 2.  RE: NORUN TODAY after specified date
    Best Answer

    Posted 04-06-2020 01:36 PM
    Hi Loren,
    I think the order of the date needs to change. See the line below.
    IF '%ESPSYEAR%ESPSMM%ESPSDD' GT '20200301' THEN NORUN TODAY

    In the example provided,  01012021 although it is next year the job would run because 01012021 is not greater than 03012020.

    If you wanted it to be a REQUEST job after that date, the line would look like the one below.
    IF '%ESPSYEAR%ESPSMM%ESPSDD' GT '20200301' THEN JOBATTR REQUEST

    Let me know if I "missed the boat"

    Don



  • 3.  RE: NORUN TODAY after specified date

    Posted 04-06-2020 02:20 PM
    Mission accomplished Don. Thank you for your help.  Changing to JOBATTR REQUEST meets my need.
    It doesn't look like the date format was at fault, as both YEARMMDD and MMDDYEAR work in my limited testing using your suggested JOBATTR.

    IF '%ESPSYEAR%ESPSMM%ESPSDD' GT '20200301' THEN JOBATTR REQUEST
    IF '%ESPSMM%ESPSDD%ESPSYEAR' GT '03012020' THEN JOBATTR REQUEST

    For my understanding, I am curious why IF THEN NORUN TODAY does not work. Changing NORUN to YEARMMDD  did not work either. Perhaps NORUN TODAY is not respected by ESP when demanding a job / triggering it adhoc? That's probably not it...


    ------------------------------
    Cigna
    ------------------------------



  • 4.  RE: NORUN TODAY after specified date

    Posted 04-06-2020 03:03 PM
    Hi,
    The line below works for me if I simulate for any day greater than March 1 2020.
    IF '%ESPSYEAR%ESPSMM%ESPSDD' GT '20200301' THEN NORUN TODAY

    How are you demanding the job in? The scenario will prevent the job from building if it is triggered in with a date greater than Mar 01 2020.

    IMPORTANT -  there is a BIG difference between YEARMMDD and MMDDYEAR. The proof would be simulating it for JAN 1 2021.  It will run with the MMDDYEAR IF statement.

    Below is the example for Jan 1 2021.
    YEARMMDD -  IF 20210101 GT 20200301 THEN NORUN  (WILL NOT BUILD).
    MMDDYEAR -  IF 01012021 GT 03012020 THEN NORUN  (WILL BUILD since 01... is less than 03.....)

    Let me know if you have any questions.  We can have a call if you would like.

    Don


  • 5.  RE: NORUN TODAY after specified date

    Posted 04-07-2020 08:10 AM
    Edited by Joseph Mendygral 04-07-2020 08:10 AM
    You could also specify the date you want the NORUN to begin.  The example below would have the job continuing to run on Weekdays until Apr 30 2020 and then the NORUN would kick in on May 1st.

    LINUX_JOB DATE_TEST
    RUN WEEKDAYS
    NORUN ANY STARTING MAY 01 2020
    cmdname date
    USER user1
    AGENT agent1
    ENDJOB




  • 6.  RE: NORUN TODAY after specified date

    Posted 04-07-2020 09:10 AM
    Thank you Joseph. I will add this statement to my arsenal.  Don, I was incorrectly demanding the job for my testing. And thanks for reinforcing YEARMMDD vs MMDDYEAR; got it.

    ------------------------------
    Cigna
    ------------------------------



  • 7.  RE: NORUN TODAY after specified date

    Posted 04-07-2020 09:23 AM
    Hi Loren,

    Found following in Example Cookbook:
    https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/examples-cookbook/schedule-job-within-date-range.html
    Objective
    Schedule a job to run within a specific date range. For example, run a job every Thursday between April 17, 2005 and November 6, 2005, inclusively.
    Solution
    Use the following statements for the job:
    JOB A
     IF DAYS_FROM('APR 17,2005') GE 0 -
      AND DAYS_TO('NOV 6,2005') GE 0 -
       THEN RUN THURSDAY
    ENDJOB
    Explanation
    This solution uses the DAYS_FROM and DAYS_TO built-in functions to check if the current day is within the required date range. If it is, the job is selected to run on Thursdays.
    --------------

    So you could also use something similar:
    IF DAYS_TO('MARCH 1 2020') GT 0 THEN RUN WEEKDAYS

    Lucy



  • 8.  RE: NORUN TODAY after specified date

    Posted 04-07-2020 10:18 AM
    Thank you for your help Lucy. I have not seen DAYS_FROM, DAYS_TO before. I'll check out those functions. I look through online documentation before bothering this community, but couldn't find what I needed.

    ------------------------------
    Cigna
    ------------------------------



  • 9.  RE: NORUN TODAY after specified date

    Posted 04-07-2020 11:03 AM
    Hi Loren,

    Following is the online doc link for DAYS_TO and other similar functions:
    https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/using/use-procedures/calendaring-functions.html

    You are right, it's not very easy to search the manuals on how to code for specific scheduling requirement, So I am advertising the "Examples Cookbook", it contains many very good practical examples.

    Regards,

    Lucy