This batch example shows you how to extract and optionally delete users that have not logged on since a specific date by masking on the last TPX logon date.
TPX® Session Management for z/OS
You can extract users by masking on variable VUSRDACC which is the last TPX logon date.
The format of VUSRDACC is mm/dd/yy. For example: 10/01/24
This example will list users whose last logon was in 2023 or 2024:
//BATCHADM EXEC TPX,VNODE='*BATCH*' //EXTFIL1 DD UNIT=SYSDA,SPACE=(CYL,(1,1)),DISP=(MOD) //RPTFIL1 DD SYSOUT=* //EXTFIL2 DD UNIT=SYSDA,SPACE=(CYL,(1,1)),DISP=(MOD) //RPTFIL2 DD SYSOUT=* //SYSIN DD * C C List all users who last logged on during 2023 & 2024 C C VUSRDACC The date on which the user last signed on to CA TPX. C EXTRACT GIVING(EXTFIL1) USER AND NO SESSIONS ( VUSRDACC(------23 ------24)) SET RTITLE1 ' USERID LAST TPX LOGON in 2023 & 2024' SET RTITLE2 ' ======== =============================' REPORT GIVING(RPTFIL1) USING(EXTFIL1) (( ' &UIDXNAME' ' &VUSRDACC '))
Once you are happy with this output, then you can add the DELETE USING.
You should then run the above report again after the delete so that you have the before and after.
EXTRACT GIVING(EXTFIL1) USER AND NO SESSIONS ( VUSRDACC(------23 ------24)) SET RTITLE1 ' USERID LAST TPX LOGON in 2023 & 2024 - BEFORE DELETE' SET RTITLE2 ' ======== =============================================' REPORT GIVING(RPTFIL1) USING(EXTFIL1) (( ' &UIDXNAME' ' &VUSRDACC ')) DELETE USER USING(EXTFIL1) EXTRACT GIVING(EXTFIL2) USER AND NO SESSIONS ( VUSRDACC(------23 ------24)) SET RTITLE1 ' USERID LAST TPX LOGON in 2023 & 2024 - AFTER DELETE' SET RTITLE2 ' ======== ============================================' REPORT GIVING(RPTFIL2) USING(EXTFIL2) (( ' &UIDXNAME' ' &VUSRDACC '))
NOTE: A blank date indicates that the user has never logged on.