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:
- During the login-Procedure the values of *ETID and *USER (=the real name) is should be written into a ADABAS-File.
- 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)
- display the real user-name
I did a test on steps 2.1 to 2.5. This works so far.
- Do I really need a workfile for step 2.3?
- Is there an easier way to solve the whole problem?