Thank you both so much!
I like both ideas and tried Lucy's first. The real puzzling thing now is - though I copied it directly and it simulates exactly right - when it runs it gets an error saying the CHKTIME is not defined.
Simulate:
INVOKE SYSXR.CAESP.TET.APPLLIB(JOEJOBS)
APPL JOEJOBS
JCLLIB 'SYSXN.TESTE.SCHEDJCL'
JOB JOBA
RUN DAILY
RELEASE JOBALNK
ENDJOB
JOB JOBALNK TASK SELFCOMPLETING
GENTIME NW REALNOW
CHKTIME='%NWHH%NWMN%NWSS'
IF %CHKTIME GE '19.30.00' THEN DO
ENDDO
ENDJOB
JOB JOBB REQUEST
RUN DAILY
AFTER JOBALNK
ENDJOB
SIMULATION OF EVENT TECH.JOEJOBT AT 07.37.28 ON MONDAY NOVEMBER 25TH, 2024
JOBS: JOBA, JOBB
2 JOBS SELECTED FOR SUBMISSION
JOB TYPE-JOBNAME---HC-RELEASES
JOB JOBA 0 JOBB
REQUEST JOBB 1 (NONE)
Trigger
ESTETST0528E ERROR OCCURRED PROCESSING EVENT TECH.JOEJOBT IN APPL JOEJOBS.40
ESTETST0027E IF %CHKTIME GE '19.30.00' THEN DO
ESTETST0013E VARIABLE CHKTIME NOT DEFINED
How can it not be defined when it's defined in the previous statement?
Sorry, this just threw me for a loop - what am I missing?
Original Message:
Sent: 11/25/2024 8:36:00 AM
From: Lucy Zhang
Subject: RE: Need to Schedule a job with tricky requirements
Hi Jonas,
I like your idea of defining JOBB as a REQUEST JOB.
Following is another solution:
JOB JOBA
RUN DAILY
RELEASE JOBALNK
ENDJOB
JOB JOBALNK TASK SELFCOMPLETING
/* SELFCOMPLETING TASK will make sure the AJ command finishes before release JOBB*/
/* this will generate the current real time*/
GENTIME NW REALNOW
CHKTIME='%NWHH%NWMN%NWSS'
/* REQUEST JOBB if it's after 7.30PM*/
IF %CHKTIME GE '19.30.00' THEN DO
ESPNOMSG AJ JOBB REQUEST APPL(%ESPAPPL..%ESPAPGEN)
ENDDO
ENDJOB
JOB JOBB REQUEST
RUN DAILY
AFTER JOBALNK
ENDJOB
Original Message:
Sent: Nov 25, 2024 06:46 AM
From: Jonas Dusil
Subject: Need to Schedule a job with tricky requirements
Hi Roger,
there are probably many ways how to achieve this and your idea with logic in the link would be possible as well.
I would consider following approach:
Utilizing on-request job for JOBB. Two self-completing tasks (similar to links, but more reliable in some edge scenarios) would be used to
1. REQUEST the JOBB at specified time
2. Cleanup the first task if the request is not needed after JOBA run fine before the deadline (this is not to produce unnecessary error messages)
APPL TEST JOB JOBA RUN ANY MEMBER LONGJOB RELEASE ADD(JOBB,COMPREQ) ENDJOB JOB COMPREQ TASK SELFCOMPLETING /* completes REQB task, /* not to produce 2820E JOB JOBB HAS BEEN ALREADY BEEN BYPASSED /* from the REQUEST command /* if the error on the console and the log is not a problem, /* this job can be omitted ESPNOMSG AJ REQB COMPLETE APPL(%ESPAPPL..%ESPAPGEN) RUN ANY ENDJOB JOB REQB TASK SELFCOMPLETING /* using DELAYSUB statement postpones REQUEST of the JOBB to 7:30 DELAYSUB 7:30 ESPNOMSG AJ JOBB REQUEST APPL(%ESPAPPL..%ESPAPGEN) RUN ANY ENDJOB JOB JOBB REQUEST /* JOBB is defind as REQUEST job and will be bypassed unless REQUESTed RUN ANY MEMBER IEFBR14 ENDJOB
This is how the run before time X would look like:
COMPREQ COMPLETED AT JOBA COMPLETED AT JOBB BYPASSED REQB COMPLETED(F) AT
And this is after time X:
COMPREQ COMPLETED AT JOBA COMPLETED AT JOBB COMPLETED AT REQB COMPLETED(F) AT
Please take this only as a suggestion of how I would approach the problem. There might be other / better ways as well.
Regards
------------------------------
Jonáš Dusil
Product Owner | ESP Workload Automation | Mainframe Software Division
Original Message:
Sent: Nov 22, 2024 10:56 AM
From: RogerWeb
Subject: Need to Schedule a job with tricky requirements
I have a request to schedule JOBB that follows JOBA (which has a datset trigger) such that
- JOBB runs after JOBA only if JOBA completes after 7:30 PM
- JOBB is Completed, Abandoned or Bypassed (not run) if JOBA completes before 7:30PM
this is the rabbit trail I've gone down so far... Any ideas/suggestions would be GREAT!
Thanks all!
JOB JOBA
RUN DAILY
RELEASE JOBALNK
ENDJOB
JOB JOBALNK LINK
IF ESPAHH > '19' AND ESPAMM > '30' +
THEN COMPLETE JOBB +
ELSE RELEASE JOBB
ENDJOB
JOB JOBB HOLD
RUN DAILY
AFTER JOBALNK
ENDJOB
Roger Webster
State of Oregon