+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16

Thread: Retrieving ID of user locking a record.

  1. #1
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    I am trying to find a way to get the user ID of whoever has a lock on an individual record in a file. I can tell that a record has been locked by the error indicator on the chain to the record, but is there any way to be able to tell which user has the lock?

  2. #2
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    I'm sure there's a better way than the one I'm about to suggest, and I'd be interested to find it out too! The only things I could think of would be to check all the current sessions. Either WRKSBSJOB QINTER or WRKACTJOB to see who's got a session, and then take option 5 and then 14 to see what files they have open. Time consuming and a nuisance, but it's the only think I thought of I'm afraid. Katy

  3. #3
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    First of all, I think you have to verify the "Maximum record wait time" you defined when you created the file (it is possible to change this parameter, for example with 5 = 5 seconds, it works also with on OVRDBF) then (if you are in V4R4, I don't know for old releases), in the RPGILE program, after your CHAIN operation,you can test the BIF "status". If the status is = 1218, it would be possible (don't ask me how, but I'm sure somebody in this forum will give you the response) to treat the message CPF5027 (take a look in Job log) which indicates who is locking the record Sorry for this incomplete information, it is all I can do for the moment. Rene

  4. #4
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    There must be an API that will do the same thing as WRKOBJLCK does. I'll look through the API manual when I get a chance today and post anything I find. ==Scott==

  5. #5
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    Let me further explain just what I would like to accomplish. My application currently chains to records in a file using the (E) op extender for the chain. Before entering the program I have used the OVRDBF command to specify WAIT time to *IMMED - this will immediately give me an error on the chain to each record that is in use. I then can display on the workstation display that the record is "in use". What I would further like to do is not only tell the user that the record is in use, but be able to say "in use by XXXXX". If I could tell either the user who has the record lock or the job name (on interactive the job name will be the same as the user) I could then display this on the screen. I have noticed the CPF5027 messages being written to the job logs and have been unsuccessfully trying to find a way to capture that information. I have been looking at some API's that list job logs, but they look really complicated to use, then I still don't know whether they will give me the information that I need.

  6. #6
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    The information that you're looking for can be found on the Program Status Data Structure in positions 91-170 HTH

  7. #7
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    That worked great!!! Thanks for the advise.

  8. #8
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    The CPF5027 goes to the program message queue. Display a message subfile in your program after the unsuccessful lock attempt, and your user will automatically see the CPF5027 message on line 24: "record ### in use by job ###/###/###".

  9. #9
    Guest.Visitor Guest

    Default Retrieving ID of user locking a record.

    Has anybody ever heard of the command DSPRCDLCK.

  10. #10

    Default Retrieving ID of user locking a record.

    I was wondering the same thing. DSPRCDLCK works on my V4R2 system here just fine. It shows all record locks held on the specified physical file. The only problem is that it only has output options of display and print, not outfile, and I think randy might be wanting to display the error information to the end user. src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Java400.net - Java/400 Freeware" align="middle"> Java400.Net - where the AS/400 speaks Java with an RPG accent Home of PBD2.0, the color=red>FREE Java/400 Client/Server color=blue>Revitalization Toolkit

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Record locking problems
    By Guest.Visitor in forum Programming
    Replies: 6
    Last Post: 05-30-2001, 07:27 AM
  2. Whats locking my record
    By Guest.Visitor in forum Programming
    Replies: 1
    Last Post: 11-14-2000, 02:33 AM
  3. Record Locking
    By Guest.Visitor in forum Application Software
    Replies: 22
    Last Post: 10-18-1999, 03:20 PM
  4. More COBOL Record Locking
    By Guest.Visitor in forum Programming
    Replies: 12
    Last Post: 05-29-1998, 08:12 AM
  5. Record Locking
    By Guest.Visitor in forum Programming
    Replies: 5
    Last Post: 02-04-1998, 03:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts