Search code examples
ibm-midrangerpgle

CPF8E2F - Lock on *SRVPGM object


I have a created a service program and it is invoked from COBOL, CL and RPGLE programs. I am running into the below issue at times and i am not sure of the reasons. I tried searching in Google and StackOverflow as well but found no solutions.

Please let me know the possible reasons for this issue.

                    Additional Message Information                         

Message ID . . . . . . :   CPF8E2F       Severity . . . . . . . :   30         
Message type . . . . . :   Diagnostic                                          
Date sent  . . . . . . :   11/10/16      Time sent  . . . . . . :   10:54:52   

Message . . . . :   Object ACB0500R is temporarily unavailable.                
Cause . . . . . :   A lock on object ACB0500R of type *SRVPGM in library       
  LMIQALIB is currently held by another job. The object is unavailable for use 
  at this time.                                                                
Recovery  . . . :   Try to access the object again.  If the object is still    
  locked, use the WRKOBJLCK command to determine which job holds the lock.   

Solution

  • Did you do as instructed and use the WRKOBJLCK command to see what job had a lock on the *SRVPGM?

    There's no locks done on a *SRVPGM object during normal execution.

    The only time a *SRVPGM or *PGM object would be locked

    1. Backup/Restore operation
    2. Programmer intentionally adds a lock of the object (via ALCOBJ command or an API), to prevent multiple people from running the same program and the same time.
    3. If the *SRVPGM/*PGM is currently being run in debug in another job (maybe?)
    4. during creation (maybe?)

    3 & 4 are educated guesses...I've never actually tried to watch for a lock during those processes..

    What are you trying to do when you get the lock? Execute or recreate?