Date: Tue, 16 Jul 2002 09:19:51 -0400
Reply-To: Larry Bertolini <bertolini.1@OSU.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Larry Bertolini <bertolini.1@OSU.EDU>
Organization: Ohio State University
Subject: Re: Detecting if a batch job is running
Content-Type: text/plain; charset=us-ascii
You don't say *why* you want to know if the other job
is running; do you need to:
* not run while the other job is running?
* run only while the other job is running?
* run as soon as the other job finishes?
* just check to make sure the other job is running?
I can think of 3 approaches, to determine if a job
is running:
1. Have SAS execute a system command that will run a utility
that lists active jobs. CA-Sysview can do it; IBM SDSF
might, also. Route the output to a file, and read it with
SAS. Note that the vendor could change the format of
the utility's output, with any release, and you'll have
to modify your code.
2. If you know, for sure, that the other job has a dataset
allocated, your SAS app could use the FILENAME statement,
with a WAIT parm, to try to allocate that dataset with
DISP=OLD. Your job could wait until the other job
finishes, or perhaps it could wait 5 seconds and give up
(depending upon what you need to do).
3. Use the PEEK function to tip-toe through the system
control blocks. This may involve a considerable
investment of time, reading the IBM manuals.
Offsets in the control blocks are subject to change,
with new releases of OS/390 and JES.
Good luck.
Larry
Alistair Gordon wrote:
> Is there a way for a SAS application, or a SAS batch job, to detect if
> a certain other batch job (not necessarily SAS) is running?
>
> Using SAS6.09 and SAS 8.1 on TSO/MVS OS390
>
> Many thanks.