While I believe the SQL to the system tables is the best option for your
requirement we use a different approach which is quite generic.
We have a LOCKS table in a common library and a service program to add a
lock, remove a lock and check locks.
The table has the qualified job name and other information as the use of
this method has grown over time.
The addLock writes a record to the file with the required information
The rmvLock deletes the record from the file
The chkLock will return a flag to indicate if a lock exists or not. An
optional parameter on this function is to "Verify" in which case the
procedure will verify if the job with the lock still exists, this solves
the rare situation of a user not logging off or a program ending
abnormally and leaving a record on the locks file.
The chkLock with verify for *ALL locks is also scheduled on a daily basis.
Just my 2 cents.
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com