ESP Workload Automation

  • 1.  REEXEC plus 1 day

    Posted Jan 31, 2018 07:04 AM

    I have some jobs that cannot execute at certain hours, using the REEXEC to reset the execute time. I now have one if its after 6pm it should not execute until the next day at 6am. Tried;

     

    IF ESPATIME>'18.00.00' THEN REEXEC AT('06.00 PLUS 1 DAY')

     

    Went into a subdelay, never reset the time, never ran. What is the proper coding?

     

    Thanks

    Diane



  • 2.  Re: REEXEC plus 1 day

    Posted Jan 31, 2018 08:33 AM

    Have you thought about using a resource to do this?  You could set up a task that would deplete at 6PM and then renew at 6AM.  The only problem with this is that your REEXEC will continue to insert / or submit jobs while the resource is depleted, leaving you with a bunch of jobs that would go into RESWAIT while the resource is depleted, then execute all at once when the resource is available again at 6AM. 

     

    The way to handle this would be to create an app that contains your job, followed by a task that waits for an hour then triggers the event again.  Of course, you would not use a SCHEDULE statement in your event.  The result would be a job that runs every hour while the resource is available (6AM) until it becomes unavailable at 6PM.  You will only have one generation of the app in RESWAIT.  It will stay in that state overnight until the resource is renewed.  It will then run, wait an hour, and trigger like normal.  In our environment, we keep the tasks that deplete and renew the resource in a separate application.  Here's an example:

     

    APPL TIMEAPP

    JOB <your resource name>.UNAVAIL TASK SELFCOMPLETING
    ESPNOMSG  RESDEF <your resource name>SET AVAIL(0)  
    RUN WORKDAYS                              
    DELAYSUB 18:00                            
    ENDJOB                                    
                                              
    JOB <your resource name>.AVAIL TASK SELFCOMPLETING  
    ESPNOMSG  RESDEF <your resource name> SET AVAIL(1)  
    RUN WORKDAYS                              
    DELAYSUB 0                         
    ENDJOB

     

    ==============================================

    APPL <app name> POST_OLDEST WAIT

    NT_JOB <job name>
       RUN TODAY                                
       AGENT agentname
       CMDNAME \\path\to\script
    ENDJOB                                      

     

    JOB START TASK SELFCOMPLETING  
     RUN DAILY                     
     RELDELAY 60                   
     ESPNOMSG TRIGGER <app/event name> ADD 
     AFTER ADD(<job name>)           
    ENDJOB               

    ============================================

     

    Hope this helps!

     

    <JC>