ESP Workload Automation

  • 1.  question on scheduling a job

    Posted Jan 26, 2018 04:14 PM

    i have an application that is data set triggered and runs multiple times a day. how can I schedule a job to only run the first run of a given day?



  • 2.  Re: question on scheduling a job
    Best Answer

    Posted Jan 26, 2018 04:26 PM

    Hi, 

    One possible solution would be to have the application store a date in the global variable table. Each run would retrieve the date. If the date retrieved is today's date then don't run the job(it already ran today). If it is not today's date then run the job. 

     

    If this seems like a reasonable solution we could work on the code. This isn't terribly complex but someone may have a more elegant solution. 

     

    Don



  • 3.  Re: question on scheduling a job

    Posted Jan 26, 2018 04:32 PM

    One more thought. 

    The appl could issue a command like LTJ below and parse the output to see if the most recent job is from today. 

    LTJ DPTST001 INDEX 
    JOB DPTST001, MODEL MODEL1, OWNER NONE, 30 JOBS INDEXED, 30 MAX
    JOB04767 ON RDR AT 08.00.14 FRI 26JAN2018, COMPLETED, CC 0, 0.0

     

    This solution isn't too bad but it still takes a little code. The date in the output has a very specific format. 26JAN2018

    Don

     



  • 4.  Re: question on scheduling a job

    Posted Jan 26, 2018 04:48 PM

    thank you! I will review that. The only thing I could think of was put it in another app that schedule it and then have it wait to run when the dsn comes in and then have the original app wait for the jobs that need to run in the 1st run of the app and then the other ones have it look for the jobs and complete after a couple minutes if its not scheduled. I figured someone may have a cleaner way to schedule it and from the same app...



  • 5.  Re: question on scheduling a job

    Posted Jan 26, 2018 05:30 PM

    how would you suggest coding the ltj and parsing?



  • 6.  Re: question on scheduling a job

    Posted Jan 26, 2018 05:51 PM

    Hi, 

    I don't have something that does exactly this. I can send you something on Monday.

    There are a couple of steps to make it work. 

    1) passing in the date in the right format.

    2) Making the value YES/NO available outside the REXX so the IF logic can be used to run or not run the job. 

    3) Comparing the date. 

     

    The example below is not complete but will give you an idea. 

    REXXON GEN
    X=TRAPOUT('LINE.')
        "ESP LTJ JOBNAME INDEX'"
    X=TRAPOUT('OFF')
    DO YY = 1 TO LINE.0
         CHECK IF TODAY'S DATE IS ON LINE. AND SET YES/NO VALUE HERE.
         "YESNO1='"YESNO"'" MAKE YES/NO AVAILABLE OUTSIDE REXX
    END
    REXXOFF
    IF YESNO1 = "YES" THEN DO
        JOB ABC
            RUN ANY
        ENDJOB
    END

     

    Don



  • 7.  Re: question on scheduling a job

    Posted Jan 29, 2018 06:20 PM

    Hi, 

    My appl looks like the one below. You would need to modify the job name(DPTST001) to your job name. Let me know if you would like to discuss how it works. 

     

    APPL DPREXX29
    JCLLIB 'POWDO03.TEST.JCL'

    /*CREATE TODAYS DATE IN FORMAT 29012018 */
    TDATE = %ESPSDD + %ESPSMMM + %ESPSYEAR + ","

    REXXON
    YESNO = "NO"
    TDATE1=CLANGVAR('%TDATE')
    TDATE1= STRIP(TDATE1,L,0)
    X=TRAPOUT('LINE.')
    "ESP LTJ DPTST002 INDEX"
    X=TRAPOUT('OFF')

    /* SEE IF DATE IS IN THE SECOND LINE */
    FOUND = POS(TDATE1,LINE.2)
    IF FOUND > 1 THEN YESNO = "YES"
    "YESNO1='"YESNO"'"
    REXXOFF

    IF %YESNO1 = "YES" THEN DO
    JOB DPTST001
    RUN ANY
    ENDJOB
    ENDDO