DLCOBJ command not working

25 pts.
Tags:
AS/400
CL Program
RPG
I have a program that allocates an object (*file), calls a program, then deallocates. The dlcobj does not work. RPG PROGA calls CL PROGB which calls CL PROGC. PROGC does the alcobj and dlcobj. However when the program returns to PROGA (interactive RPG), the object is still locked. Any ideas?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Not knowing all the code, check out IBM info on the command here

Check under the note section for some helpful tip some are not aware of.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    What other properties are you using when allocating the object?
    135,525 pointsBadges:
    report
  • ttufankj

    Here's the code:

      ALCOBJ     OBJ((LOCKPGMP *FILE *EXCL)) WAIT(120) 
                                                       
      CALL WSCHKSTSR (&pgm &plock &pcheck &plocked)    
                                                       
      DLCOBJ     OBJ((LOCKPGMP *FILE *EXCL))           
                                                       

    25 pointsBadges:
    report
  • GregManzo
    It is possible to have multiple locks on the same object, both different types of locks (*SHRUPD, *EXCL) and the same type of lock (*SHRRD 5 times). Each lock needs to be deallocated.
    I suspect what you are doing here is that the CL gets an *EXCL lock, then the RPG opens the file, and in doing so gets an implied lock (probably *SHRUPD or *SHRRD), then the CL releases its *EXCL lock but you are left with the implied lock because the file is still open in the RPG.
    a) Check how many and what type of lock you have while still inside WSCHSTSR,
    b) Try having WSCHSTSR close the file before it returns.
    2,970 pointsBadges:
    report
  • ttufankj
    Ok, I put in a CLOSE in WSCHSTSR. I'll let you know what happens. Thanks!
    25 pointsBadges:
    report
  • ttufankj2
    Ok, I found the issue. The program that was locking the file bombed and the session it ran from was still active. I had to look at the job log to figure it out. Thanks everyone for your help!!!
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: