Is there a way to get a list of all TPX users with their last logon date.

Document ID : KB000019219
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

This document explains how you can create a list of TPX users and their last logon date. With this list you can cleanup your ADMIN2 file from all users not having logged on for a long time.

Solution:

This document explains how you can create a list of TPX users and their last logon date. With this list you can cleanup your ADMIN2 file from all users not having logged on for a long time.
The field VUSRDACC contains the day the user last logged on to TPX. To get a list of all users and their last-logon-date this TPXBATCH-Job can be used:


 //BATCHADM EXEC ,VNODE='*BATCH*'                     
 //EXTFILE  DD   DSN='aaa.bbb.EXTRACT',DISP=SHR                   
 //RPTFILE  DD   DSN='aaa.bbb.REPORT',DISP=SHR                    
 //SYSIN    DD   *                                                
 C -------------------------------------------------------------------
 C THIS TPX BATCH JOB LISTS ALL USERS OF TPX AND THEIR LAST LOGON DATE
 C -------------------------------------------------------------------
 EXTRACT GIVING(EXTFILE) USER AND NO SESSIONS (VUSRDACC(--------))
 SET RTITLE1 '1USERNAME LAST LOGON'    
 SET RTITLE2 ' -------- ----------'    
 REPORT GIVING(RPTFILE) USING (EXTFILE)
   (                                   
  (' &UIDXNAME' '&VUSRDACC')           
   )                                   
 //          

This Job uses preallocated file 'aaa.bbb.REPORT'. (FB 80) and is filled with a list like this after being submitted:


1USERNAME LAST LOGON
 -------- ----------
 ERWIN    07/10/13  
 FRANK    04/05/12  
 HIHEWRS  10/17/11  
 GILHA03  05/22/12  
 MEYER    01/26/12  
 PIEALE1  10/30/13  
 TIERTEST 09/09/11  
 TPXADMIN 10/17/12  
 TPX123   09/03/10 

This list is not sorted. If you are interested in the users having logged on for the last time in 2010 then change the EXTRACT Statement as follows:

  EXTRACT GIVING(EXTFILE) USER AND NO SESSIONS (VUSRDACC(------10))

If you are interested in the users having logged on for the last time between 2000 and 2009 then change the EXTRACT Statement as follows:

  EXTRACT GIVING(EXTFILE) USER AND NO SESSIONS (VUSRDACC(------0-))
If you are interested in the users having logged on for the last time in 2011 or 2012 then change the EXTRACT Statement as follows (all text in one line!):
  EXTRACT GIVING(EXTFILE) USER AND NO SESSIONS (VUSRDACC(------11) VUSRDACC(------12))

In this case the control statement line is longer than 80 characters and therefore does not fit in one line.

As there are no Continuation Characters in TPXBATCH you need to put the complete SYSIN-Statements in a dataset with longer Record length and then specify that dataset in the SYSIN-card.

If you need to sort the complete list of users created by the above Job then this can be achieved by a SORT-Job:


 //SORTING  EXEC PGM=SORT                                  
 //SORTIN   DD   DSN=aaa.bbb.REPORT,DISP=SHR                
 //SORTLIB  DD   DSN=SYS1.SORTLIB,DISP=SHR                  
 //SORTOUT  DD   DSN=aaa.bbb.SORTREP,DISP=SHR               
 //SORTWK01 DD   UNIT=SYSDA,VOL=SER=vvvvvv,SPACE=(CYL,(2,2))
 //SORTWK02 DD   UNIT=SYSDA,VOL=SER=vvvvvv,SPACE=(CYL,(2,2))
 //SYSOUT   DD   SYSOUT=A                                   
 //SYSIN    DD   *                                          
  SORT FIELDS=(17,2,CH,A,14,2,CH,A,11,2,CH,A)             
 /*

Take care that 'aaa.bbb.SORTREP' is defined with the same parameters as 'aaa.bbb.REPORT'. The SORT criteria in SYSIN does first sort after columns 17 and 18 (here the year is located in this example of the list - that can differ if you specify a different layout in the TPXBATCH-Job) in ascending order: FIELDS=(17,2,CH,A,...). Then it sorts after the month in columns 14 and 15: FIELDS=(...,14,2,CH,A,...), finally after the day which is located in columns 11 and 12: FIELDS=(...,11,2,CH,A). The list of users then is sorted after the last logon date:


SAMPLE output
  -------- ----------
 1USERNAME LAST LOGON
  TPX123   09/03/10
  TIERTEST 09/09/11
  HIHEWRS  10/17/11
  FRANK    04/05/12
  TPXADMIN 10/17/12
  GILHA03  05/22/12
  MEYER    01/26/12
  ERWIN    07/10/13
  PIEALE1  10/30/13