===== Tracking Batch Jobs ===== In any busy IT/IS shop, there are usually "a lot" of batch jobs queued for various scheduled and event-driven times. It can be a challenge to track them all, to check on them to see if: * Each job has run when it's supposed to... * Jobs are queued and holding for the appropriate time of day, week or month (usually with the ''/AFTER=datetime'' qualifier)... * Jobs that have failed and should be restarted... * Jobs that have failed and resubmitted themselves... * Jobs that are currently executing, or in a stalled, aborting, suspended or other state... Since many shops have an excess (usually, far too many) batch (and printer) queues, doing the command: $ SHOW QUEUE /ALL /FULL just generates a huge list of text to search through visually... finding what you're looking for can be either a challenge or an exercise in futility. And it doesn't help that, in this area at least, the design of the ''SHOW QUEUE'' command's output (done back in the early days of VMS) is pretty messy, unorganized and difficult to comprehend. ==== A Helpful Solution ==== Take a look at the ''SHOW QUEUE'' command's ''/BY_JOB_STATUS'' qualifier. It produces output which is filtered by job-status category, i.e., ''EXECUTING'', ''HOLDING'', ''PENDING'', ''RETAINED'' or ''TIMED_RELEASE''. And, of course, you can specify a queue by name to further limit/filter the output. So, for example, to see what's running (''EXECUTING'') right now in batch: $ SHOW QUEUE /BY_JOB_STATUS=EXECUTING SYS$BATCH Batch queue SYS$BATCH, idle, on POPEYE:: /BASE_PRIORITY=4 /JOB_LIMIT=1 /OWNER=[1,4] /PROTECTION=(S:M,O:D,G:R,W:RS) /RETAIN=ERROR Entry Jobname Username Status ----- ------- -------- ------ 385 FTP_TO_QBRANCH JBOND EXECUTING Or, to see full details on all jobs set to run at specific days-&-times (distinct from pending and holding jobs -- see the help text): $ SHOW QUEUE /ALL /FULL /BY_JOB_STATUS=TIMED_RELEASE Batch queue SYS$BATCH, idle, on POPEYE:: /BASE_PRIORITY=4 /JOB_LIMIT=1 /OWNER=[1,4] /PROTECTION=(S:M,O:D,G:R,W:RS) /RETAIN=ERROR Entry Jobname Username Status ----- ------- -------- ------ 9794 FTP_TO_CHAOS MSMART Holding until 13-FEB-2019 22:30:00.00 Submitted 13-FEB-2019 08:08:09.61 /KEEP /NOPRINT /PRIORITY=50 File: _DSA2:[MSMART.TOPSECRET.SCRIPTS]FTP_TO_CHAOS.COM;13 ... (lots more output, redacted) ... Use the ''/FULL'' qualifier to chase down what DCL command file (script) is actually submitted for each particular batch job; omit that qualifier for a more concise listing. ==== Make a Command Symbol ==== Here's a handy command symbol to make this ''SHOW QUEUE /BY_JOB_STATUS'' command easier to type and use: $ QSTAT*US == "SHOW QUEUE /BATCH /ALL /BY_JOB_STATUS=" Be sure that the qualifier ''/BY_JOB_STATUS='' appears last in this command alias, so that you can use it like this: $ qstat exec ... or $ qstat hold /FULL ! the /FULL qualifier works fine after the "hold" for /BY_JOB_STATUS= ... or even $ qstat (hold,pending) /FULL There... Makes checking on your batch jobs a bit easier, eh?