I'm trying to find a way to check the current usage of a table because my script needs exclusive access to perform a SET TRIGGERS statement. In the script I've called 'onstat -g sql sessions' (from which's output I grep for the tablename) but that returns only the last parsed statements by the active sessions. It frequently goes wrong and I guess that's because the table is accessed by an open cursor in the 4GL application.
Does anyone have any clue to check for these kind of conditions?
This gives me some very useful clues. I still have to figure out where to get the tabname of the specific production databases table that's being locked but I guess it's possible starting from here. Can you tell me where to get the information about the views used in your query? I'm not realy familiar with the sysmaster database and I don't get any results when I search for the view names in my document set.
BTW, I abandoned the use of a script and coded the thing in an application language. By this I can disable the trigger, update some records and enable the trigger again in one transaction so it's not necesary anymore to check the exclusive tableaccess in front. It still would be nice though to inform the user who performs this function about the users who are locking the table.