3,370 pts.
 How to check for file locks in Batch
Hi, I would like to check for locks on a PF/LF and need to send message to corresponding user. So, I cant use WRKOBJLCK as it will act interactively or Print the locks. Please suggest me if there is any alternative to check for file locks. Thanks, Pradeep

Software/Hardware used:
ASKED: December 31, 2012  5:43 AM
UPDATED: December 31, 2012  12:57 PM

Answer Wiki:
You could use ALCOBJ with a MONMSG
Last Wiki Answer Submitted:  December 31, 2012  12:57 pm  by  Michael Tidmarsh   11,390 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   11,390 pts. , CharlieBrowne   32,835 pts. , deepu9321   3,370 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The List Object Locks (QWCLOBJL) API is probably the most common method of retrieving a list of locks for an object by programming. — Tom

 107,995 pts.

 

The Retrieve Lock Information (QWCRLCKI) API could also be used, but it is less widely known. It can be simpler for some cases since it returns its results in a receiver variable. — Tom

 107,995 pts.

 

You can use WRKOBJLCK to find all locks.Note it down some where and then use sndbrkmsg ,F4 then mention all work station that You have noted.You can send anu text message to all workstation

 60 pts.

 

You can use WRKOBJLCK to find all locks.Note it down some where…
 
Since the request is to do it in batch, how do you recommend that the results be “noted down”?
 
Tom

 107,995 pts.

 

Here is a scenario we handle in a couple batch jobs that run everyday.  If the batch job encounters a record lock, a message is sent to our operator so that she can resolve the record lock, answer the message so batch processing can continue.After the i-o operation in the batch job – we check for record lock – if lock is encountered, the above described routine is performed.  If you are interested is this – I could post more information.

 185 pts.

 

In general, I place an exclusive lock on the file with a MONMSG for unable to place the lock. If the MONMSG hits then the file is in use.
I’ll typically keep the lock on until the special process (reason for testing lock in the first place) is finished. Then remove the lock.

 1,565 pts.