There is the cheap and easy way that isn’t as precise as many would like and a choice of either a very difficult way or a potentially costly way but both with significant precision.
Cheap and easy is by setting the QINACTITV system value to 60 along with setting the QINACTMSGQ system value to be either *ENDJOB or *DSCJOB. Once you set those values, a system timer will go off every 60 minutes. Interactive jobs that have had no activity in the previous 60 minute interval will be ended or disconnected.
The difficult way is to code programming that tracks interactive activity of jobs to whatever precision you are able to determine. Your programming decides which jobs to act on and what action to take.
The potentially costly way is to purchase a product that does the task for you.
The general trouble with the first option is that inactivity is checked against all jobs over an interval. A job might start one minute after the system timer runs. The next time the timer goes off, that job will show as having activity 59 minutes earlier; so it will be allowed to continue. The second time the timer goes off, the job will show as being inactive for 119 minutes; so it will be ended (or disconnected or cause a message to be sent).
That is a degree of imprecision that is not acceptable to some. On average, jobs may be inactive for 90 minutes before being ended. Minimum is 60 minutes (and a fraction of a second). Maximum is 119 minutes, 59.999 seconds. It depends on when the jobs begin their inactivity within a timer cycle.
If strict precision isn’t that big of a deal, then the QINACT* system values will work easily and automatically with no further effort.