Would something like this work? Try for 30 seconds if not available wait 30 seconds and repeat
ALCOBJ OBJ((QDDSSRC *FILE *EXCL)) WAIT(30)
MONMSG MSGID(CPF1002) EXEC(DO)
DLCOBJ OBJ((QDDSSRC *FILE *EXCL))
MSG(‘File MCPARMS in Library IBCFLPROD +
not locked.’) VALUES(C G) DFT(C) +
MSGTYPE(*INQ) TOUSR(*REQUESTER) +
- – - – - – - – - – - – - – - –
You may care to add a countdown loop into that, to be sure of an exit.
You could use the API to extract details of the locks, and message the ‘locker’, or add to your own message the ID of the user/job which is holding the object.
When you find out what’s holding it, go to the code and change it. There aren’t many things which need a long time lock on an iSeries. If the lock is there to keep people out of something, then you’ll need a generic solution, as you’re really using the object lock as a security feature.
- – - – - – - – - – - – -