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?
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.
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
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...
how would you suggest coding the ltj and parsing?
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
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
Retrieving data ...