How to get the name of the user who is holding a record?

Hello all!

If a NAT3145 happens in our dialogs, we are telling the user that the record is currently used by “somebody else”. For some applications (e.g. item master) it would be very useful to tell the user the real name of the user who locks the records. So the users would be able to call each other. It is also possible, that one user tries to lock a record twice (using two Natural-sessions). Then the user’s name would be a useful information, too.

The problem is: How to get the real name of the user who is holding the record? Every user can open as many dialog as he wants. The Natural-Parameter ETID is automatically set to $$ and we cannot change this because the value has to be unique.
The login-Procedures are self-coded. So our database administrator got the following idea:

  1. During the login-Procedure the values of *ETID and *USER (=the real name) is should be written into a ADABAS-File.
  2. If NAT3145 occurs:
    2.1. Call a subprogram with DDM-NAME and ISN as parameters
    2.2. find out the regarding Adabas-DBID and file number using USR1033N and USR1040N
    2.3. execute an “adaopr db=DBID di=hq > workfile” using CALL ‘SHCMD’
    2.4. read the workfile and get the ETID of the wanted User
    2.5. Read the Adabas-File mentioned in step 1 (which contains *ETID and *USER)
  3. display the real user-name

I did a test on steps 2.1 to 2.5. This works so far.

My doubts:

  • Do I really need a workfile for step 2.3?
  • Is there an easier way to solve the whole problem?

Thanks,

Matthias

Finally, we found a working solution for us. But it’s only possible, because of the following situation:

  • everybody is working on the same server (via Entire Screen builder)
  • the Server is hosting the NATURAL Runtime environment and the ADABAS Database
    So it’s possible to run a shell-command with “adaopr db=DBID di=hq” in our Natural-Programs to get the desired information (as described above).

But it would be better to get the ETID/PID-Information without calling a shell-command. If anybody knows a better way, please let me know :wink: