We want to detect whether or not a job is running, and if it is, run
another job to gracefully shut down the first job. This will be
automated with a scheduler, with pager notification on failure (which no
one wants). Our admins have something like this already in place for
some jobs, and our developers have a different approach elsewhere. I
would like feedback on any merits one approach may have over the other
(ignoring probably typos I made, and stylistic concerns such as
FINFO('SJABC',19) instead of EOF). Both approaches make assumptions that
seem reasonable right now, such as in the job card, or the CIERROR value
to test for, but someone reading this may have regretted similar
assumptions that one day were no longer true. To avoid bias, I will
identify them as approach one and two, with apologies to Dr. Suess's
thing one and thing two.
Approach one:
:JOB JOBSTOP,MANAGER.SYS,PUB.
...
:PURGE SJABC
:SHOWJOB JOB=J0123456,BATCHJOB.ABC > SJABC
:SETVAR NUMRECS FINFO('SJABC',19)
:IF NUMRECS = 6 THEN
: STREAM J6543210.BATCHJOB.ABC
:ENDIF
:PURGE SJABC,TEMP
Approach two:
:JOB JOBSTOP,BATCHJOB.ABC
...
:SHOWPROC;JOB=J0123456,!HPUSER.!HPACCOUNT
:IF CIERROR OK
: STREAM J6543210.BATCHJOB.ABC
:ENDIF
|