Path: utzoo!mnetor!uunet!husc6!ncar!ames!pasteur!ucbvax!DRCVAX.ARPA!graham From: graham@DRCVAX.ARPA Newsgroups: comp.os.vms Subject: HOW TO RESET ERRANT NEW MAIL COUNTS Message-ID: <8803211456.AA00341@ucbvax.Berkeley.EDU> Date: 14 Mar 88 14:12:00 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: Organization: The Internet Lines: 48 Greetings and Hallucinations, From time to time, I see the subject come up about errant new mail counts in VMSMail. These happen because the pointer in VMSMAIL.DAT gets munged for some reason. The usual solution is to to a READ/NEW for each count, and they will go away. Here is a little command procedure that will clear any count for any user. As you can see, it can actually set the mailcount to any desired number, (April Fools??). This does require privs, so it's not a toy for abuse, but can be rather handy if dealing with someone witn messed up mail counts. Enjoy, Dan Graham P.S. If this has already been posted, disregard... ........................................................................ $! $! Command file SET_NEWMAIL_COUNT.COM to examine and optionally change $! the 'newmail' counter for a VAXmail user. $! $ OLD_PRIV=F$SETPRIV("BYPASS") $ IF .NOT. F$PRIVILEGE("BYPASS") THEN $GOTO NOPRIV $ READ/PROMPT="Enter User name to change: " SYS$COMMAND USER $ USER=F$EDIT(USER,"TRIM,COMPRESS,UPCASE") $ OPEN/SHARE=WRITE/READ/WRITE FILE SYS$SYSTEM:VMSMAIL.DAT $ READ/INDEX=0/KEY="''USER'"/ERROR=NONE_SUCH FILE RECORD $ NEW_CNT=F$CVUI(33*8,16,RECORD) ! Determine count from record $ WRITE SYS$OUTPUT "User ''user' has ''new_cnt' new messages." $ READ/PROMPT="Enter new count to leave untouched " SYS$COMMAND CNT $ IF CNT .NES. "" THEN $GOTO MODIFY $ WRITE SYS$OUTPUT "Count unchanged" $ GOTO XIT $MODIFY: $ RECORD[33*8,16]=F$INTEGER(CNT) !alter field in record $ WRITE/UPDATE FILE RECORD !put record back $ GOTO XIT $NONE_SUCH: $ WRITE SYS$OUTPUT "User ''user' does not exist" $XIT: $ CLOSE FILE $ SET_PRIV=F$SETPRIV(OLD_PRIV) $ EXIT $NOPRIV: $WRITE SYS$OUTPUT "Not enough privileges...." $ EXIT ------