Identify users that have never logged in

Here's a CLP and a CMD that list all of the users who have never been logged and have been created for more than "N" days ago. We create this due to the auditors. I hope you'll find them useful.


CMD        PROMPT('Users never signed on')               
PARM       KWD(LIMIT) TYPE(*CHAR) LEN(5) DFT(60) +       
             REL(*GE 60) CHOICE('A number greater than + 
             59') PROMPT('Maximum number of allowed days')
             DFT(T) VALUES(T V) PROMPT('(T)heorical +    


             PGM        PARM(&LIMITA &MODE)                
             DCLF       FILE(QTEMP/USER)                   
             DCL        VAR(&CRTDTA) TYPE(*CHAR) LEN(13)   
             DCL        VAR(&CRTYMD) TYPE(*CHAR) LEN(6)    
             DCL        VAR(&CRTDTAJUL) TYPE(*CHAR) LEN(6) 
             DCL        VAR(&TODAY) TYPE(*CHAR) LEN(6)     
             DCL        VAR(&TODAYJUL) TYPE(*CHAR) LEN(6)  
             DCL        VAR(&MODE) TYPE(*CHAR) LEN(1)      
             DCL        VAR(&LIMITA) TYPE(*CHAR) LEN(5)    
             DCL        VAR(&DELTAA) TYPE(*CHAR) LEN(5)    
             DCL        VAR(&Y2) TYPE(*CHAR) LEN(2)        
             DCL        VAR(&D2) TYPE(*CHAR) LEN(3)        
             DCL        VAR(&Y1) TYPE(*CHAR) LEN(2)        
             DCL        VAR(&D1) TYPE(*CHAR) LEN(3)        
             DCL        VAR(&Y2N) TYPE(*DEC) LEN(2 0)                 
             DCL        VAR(&D2N) TYPE(*DEC) LEN(3 0)                 
             DCL        VAR(&F2N) TYPE(*DEC) LEN(5 0)                 
             DCL        VAR(&Y1N) TYPE(*DEC) LEN(2 0)                 
             DCL        VAR(&D1N) TYPE(*DEC) LEN(3 0)                 
             DCL        VAR(&F1N) TYPE(*DEC) LEN(5 0)                 
             DCL        VAR(&DELTA) TYPE(*DEC) LEN(5 0)               
             DCL        VAR(&LIMIT) TYPE(*DEC) LEN(5 0)               
             CHGVAR     VAR(&LIMIT) VALUE(&LIMITA)                    
             IF         COND(&LIMIT < 60) THEN(CHGVAR VAR(&LIMIT) +   
             DLTF       FILE(QTEMP/USER)                              
             MONMSG     MSGID(CPF2105)                                
             DSPUSRPRF  USRPRF(*ALL) OUTPUT(*OUTFILE) +               
             RTVJOBA    DATE(&TODAY)                                  
             CVTDAT     DATE(&TODAY) TOVAR(&TODAYJUL) +                
                          FROMFMT(*SYSVAL) TOFMT(*JUL) TOSEP(*NONE)    
             CHGVAR     VAR(&Y2) VALUE(%SST(&TODAYJUL 1 2))            
             CHGVAR     VAR(&D2) VALUE(%SST(&TODAYJUL 3 3))            
             CHGVAR     VAR(&Y2N) VALUE(&Y2)                           
             CHGVAR     VAR(&D2N) VALUE(&D2)                           
             CHGVAR     VAR(&F2N) VALUE(&Y2N * 365)                    
             CHGVAR     VAR(&F2N) VALUE(&F2N + &D2N)                   
 READ:       RCVF                                                      
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))          
             IF         COND(&UPPSOD = '      ') THEN(DO)              
             CHGVAR     VAR(&CRTYMD) VALUE(%SST(&CRTDTA 2 6))          
             CVTDAT     DATE(&CRTYMD) TOVAR(&CRTDTAJUL) +              
                          FROMFMT(*YMD) TOFMT(*JUL) TOSEP(*NONE)       
             CHGVAR     VAR(&Y1) VALUE(%SST(&CRTDTAJUL 1 2))        
             CHGVAR     VAR(&D1) VALUE(%SST(&CRTDTAJUL 3 3))        
             CHGVAR     VAR(&Y1N) VALUE(&Y1)                        
             CHGVAR     VAR(&D1N) VALUE(&D1)                        
             CHGVAR     VAR(&F1N) VALUE(&Y1N * 365)                 
             CHGVAR     VAR(&F1N) VALUE(&F1N + &D1N)                
             CHGVAR     VAR(&DELTA) VALUE(&F2N - &F1N)              
             IF         COND(&DELTA < 0) THEN(CHGVAR VAR(&DELTA) +  
             CHGVAR     VAR(&DELTAA) VALUE(&DELTA)                  
             MONMSG     MSGID(CPF0819) EXEC(CHGVAR VAR(&DELTA) +    
             IF         COND(&DELTA > &LIMIT) THEN(DO)              
             IF         COND(&MODE = 'D') THEN(CHGUSRPRF +          
                          USRPRF(&UPUPRF) STATUS(*DISABLED))        
             IF         COND(&MODE *EQ 'D') THEN(SNDPGMMSG +        
                          MSG('User' *BCAT &UPUPRF *BCAT 'HAS BEEN + 
                          DISABLED by cmd XUSRCTL'))                 
             IF         COND(&MODE *NE 'D') THEN(SNDPGMMSG +         
                          MSG('User' *BCAT &UPUPRF *BCAT 'never +    
                          logged in, created' *BCAT &DELTAA *BCAT +  
                          'days ago'))                               
             GOTO       CMDLBL(READ)                                 
 END:        DSPJOBLOG  OUTPUT(*PRINT)                               


This was first published in February 2007

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.