When I run a TPX batch report of users and their sessions some deleted sessions still appear. Why is that?
When a user is assigned sessions via a profile and one of these sessions is deleted on a user level the record still exists but it is marked as deleted. It cannot be physically deleted from the ADMIN2 file because it belongs to a Profile and is not assigned directly to the user. You can reference this marker via TPXBATCH variable UENTDEL. UENTDEL specifies if a user session is deleted or not for that user.
So if you want to list users who have a specific session assigned you can use this EXTRACT Statement:
EXTRACT GIVING(EXT) USER AND MATCHING SESSIONS (
UIDXNAME(--------) UENTAPPL(TSO))
The EXTRACT Dataset will contain all users which have a record TSO but all records with TSO being deleted for a user are also included. With the addition of parameter UENTDEL(N) you get only the records where TSO is not marked as deleted for users:
EXTRACT GIVING(EXT) USER AND MATCHING SESSIONS (
UIDXNAME(--------) UENTAPPL(TSO) UENTDEL(N))