$! ********************************************************************** $! * CLEAN_MAIL_PROFILES.COM * $! * This procedure removes VMS Mail profiles for users not found * $! * in SYSUAF.DAT. * $! * * $! * Define any exemptions in symbol Exempt_List. These entries will * $! * not be removed. Separate entries with a vertical bar, for ex: * $! * Exempt_List = "|FORWARD1|JOE|TEST|" * $! * Exempt_List = "|RICH|" * $! * * $! * This software has been released into public domain. This * $! * software may be freely copied, distributed, and modified so * $! * long as it contains this message. This software is provided * $! * as is, free of charge. The author assumes no responsibility * $! * or liability for the use of this software. * $! * * $! * Richware http://richj.home.mindspring.com/Richware * $! * * $! * 05-FEB-1997 RDJ Command Procedure Creation. * $! ********************************************************************** $! $ Exempt_List = "|RICH|" $ Close/NoLog UAF_File $ Close/NoLog MailFile $ Close/NoLog OutFile $ If F$TrnLnm("SYSUAF") .EQS. "" $ Then $ Open/Share/Read/Error=No_UAF_File UAF_File SYS$SYSTEM:SYSUAF.DAT $ Else $ Open/Share/Read/Error=No_UAF_File UAF_File SYSUAF $ EndIf $ If F$TrnLnm("VMSMAIL_PROFILE") .EQS. "" $ Then $ Open/Share/Read/Error=No_Mail_File MailFile SYS$SYSTEM:VMSMAIL_PROFILE.DATA $ Else $ Open/Share/Read/Error=No_Mail_File MailFile VMSMAIL_PROFILE $ EndIf $! $ PID = F$GetJPI("","PID") $ Temp_File = "SYS$SCRATCH:CLEAN_MAIL_PROFILES.''PID'" $ Open/Write OutFile 'Temp_File' $ Write OutFile "$ SET VERIFY" $ Write OutFile "$ MAIL" $ User_Count = 0 $ Mail_Loop: $ Read/End_Of_File=No_More_Profiles MailFile Line $ Username = F$Edit(F$Extract(0,12,Line),"Trim,UpCase") $ Read/Error=No_UAF_Entry/Key='Username' UAF_File Line $ Goto Mail_Loop $ No_UAF_Entry: $ If F$Locate("|''Username'|",Exempt_List) .EQ. F$Length(Exempt_List) $ Then $ Write OutFile "REMOVE ''Username'" $ User_Count = User_Count + 1 $ EndIf $ Goto Mail_Loop $ No_More_Profiles: $ Write OutFile "EXIT" $ Write OutFile "$ SET NOVERIFY" $ Write OutFile "$ EXIT" $ Close OutFile $ If User_Count .EQ. 0 $ Then $ Delete/NoLog/NoConfirm 'Temp_File';* $ Write SYS$OUTPUT "All VMSMAIL profile entries have active accounts on this system." $ Goto Exit $ EndIf $ Write SYS$OUTPUT "This procedure found ''User_Count' VMSMail profile entries to delete." $ Write SYS$OUTPUT "A command procedure has been created to do this, and is called:" $ Write SYS$OUTPUT Temp_File $ Write SYS$OUTPUT "" $ Get_Answer: $ Read/Error=Exit/Prompt="Do you wish to execute this procedure now (y/n)? " SYS$COMMAND Answer $ Answer = F$Edit(F$Extract(0,1,Answer),"Trim,UpCase") $ If Answer .EQS. "N" Then Goto Exit $ If Answer .NES. "Y" Then Goto Get_Answer $ On Error Then Goto Exit $ @'Temp_File' $ Delete/NoLog/Confirm 'Temp_File';* $ Exit: $ Close/NoLog UAF_File $ Close/NoLog MailFile $ Exit $! $ No_UAF_File: $ Write SYS$OUTPUT "Unable to open SYSUAF.DAT -- Check logical SYSUAF" $ Goto Exit $ No_Mail_File: $ Write SYS$OUTPUT "Unable to open VMSMAIL_PROFILE.DATA -- Check logical VMSMAIL_PROFILE" $ Goto Exit