From:	CSBVAX::MRGATE!graham@drcvax.arpa@SMTP 18-MAR-1988 09:06
To:	ARISIA::EVERHART
Subj:	HOW TO RESET ERRANT NEW MAIL COUNTS


Received: from drcvax.arpa by KL.SRI.COM with TCP; Wed 16 Mar 88 08:56:18-PST
Date: 14 Mar 88 09:12:00 EST
From: <graham@drcvax.arpa>
Subject: HOW TO RESET ERRANT NEW MAIL COUNTS
To: "info-vax" <info-vax@kl.sri.com>
Reply-To: <graham@drcvax.arpa>

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 <RETURN> 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

------
