Mike

I did not test 5.0.16 but I don't think this code has changed much so I expect this will work for you.

in 1 terminal I started a transaction and set a global

USER>tstart

TL1:USER>s ^bjb("TSTART")=1
 
TL1:USER>

I got the Pid from the terminal window and then in a second terminal I looked at the Process Query:

USER>s p=##class(%SYS.ProcessQuery).%OpenId(11772)
 
USER>w p.InTransaction
197264

If the process is in a transaction the value is > 0.  This value is the offset in the journal file where the transaction started.  If the Journal File switches the offset does not change so it is not clear what file to look in if you are looking for long transactions.

To find long transactions you would need to write some code that would run every x minutes, loop over all the processes, and check to see if any are in a transaction.  If they are save the current journal file, the offset, and the time.  You would then be able to find transactions that are open for a long time and look at the journal file to figure out what they are trying to do and why the transaction is not committed.