[comp.os.vms] HOW TO RESET ERRANT NEW MAIL COUNTS

graham@DRCVAX.ARPA (03/14/88)

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

------

patricky@usage.unsw.oz (Patrick Young) (03/29/88)

	Another way to reset erroneous new mail count messages is to
post yourself a number of dummy mail messages - this number should
be the same as indicated by the message. Then exit mail and make a copy
of mail.mai, say mail.new. Then get back into mail, delete all your dummy
messages. Exit mail, delete mail.mai, and rename mail.new to mail.mai
then go back into mail again and delete all the dummy messages again.
This should reset your new mail count to zero. and it requires no
special privs to do it.

GERLAND@UBVMSC.CC.BUFFALO.EDU ("Jim Gerland ", Postmaster) (04/12/88)

>From: Patrick Young
> <munnari!otc!metro!basser!elecvax!usage!patricky@uunet.uu.NET>
> 
>    Another way to reset erroneous new mail count messages is to
>post yourself a number of dummy mail messages - this number should
>be the same as indicated by the message. Then exit mail and make a copy
>of mail.mai, say mail.new. Then get back into mail, delete all your dummy
>messages. Exit mail, delete mail.mai, and rename mail.new to mail.mai
>then go back into mail again and delete all the dummy messages again.
>This should reset your new mail count to zero. and it requires no
>special privs to do it.

Why go to all this trouble when this works:

For n=1 to erroneous-mail-count
   MAIL> READ /NEW
Next n

Jim Gerland  (User Services Postmaster)
University Computing Services
State University of New York at Buffalo
Buffalo, NY   14260      (716) 636-3557