From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 10-SEP-1993 15:17:46.12
To:	EVERHART
CC:	
Subj:	RE: Checkmail Count Utility?

Date: Thu, 9 Sep 1993 9:23:41 -0400 (EDT)
From: RANDY BAKER <RBAKER@GC1.GEORCOLL.ON.CA>
To:   INFO-VAX@SRI.COM
Message-Id: <930909092341.2020351e@GC1.GEORCOLL.ON.CA>
Subject: RE: Checkmail Count Utility?

David Bell writes:

>Does anybody know of an easy way or of an Utility that will list the
>number of unread mail msgs users have, I want to do a wildcard sweep of
>my users to determine how many unread msgs they have.  I came across a user
>today who has over 2000 unread msgs.  Thanks in advance.

A friend wrote this and gave it to me.

------------------------------------ Cut Here ----------------------------------
$!
$!  File :    UNREAD.COM
$!  Authour:  Alan S. Muir
$!  Date:     17-JUL-1990
$!  Abstract: Procedure to check to see if a given user has unread MAIL.
$!  Notes:    1) This procedure will only work for users on the local node.
$!            2) If the target user has MAIL forwarding enabled, this
$!               procedure will always return 0.
$!
$       if p1 .eqs. "" then p1 = f$getjpi(0,"username")
$       once = 0
$       profile = "SYS$SYSTEM:VMSMAIL_PROFILE.DATA"
$       offset = 35
$       if f$search(profile) .eqs. ""
$       then
$          profile = "SYS$SYSTEM:VMSMAIL.DAT"
$          offset = 33
$       endif
$	write sys$output "Profile: ''Profile'"
$!
$  START:
$       open/read/share=write/error=try datafile 'profile'
$       read/index=0/key="''p1'"/error=nosuch datafile record
$       close datafile
$       unread = f$cvui(0,8,f$extract(offset,1,record))
$       outlin = f$fao("User !AS has !UL unread MAIL message!%S.", -
                       f$edit(p1, "collapse"), unread, 0)
$       goto the
$!
$  THE:
$       if once then reset = f$setprv(savprv)
$       write sys$output outlin
$       exit
$!
$  TRY:
$       if once then goto cant
$       savprv = f$setprv("SYSPRV")
$       once = 1
$       goto start
$!
$  CANT:
$       outlin = "Unable to open MAIL profile file."
$       goto the
$!
$  NOSUCH:
$       outlin = "MAIL profile file shows no record of user ''p1'."
$       goto the
------------------------------------ Cut Here ----------------------------------

--------------------------------------------------------------------------------
- Randy Baker, Operations Specialist, Georgian College, Barrie, Ontario, Canada
  RBAKER@GC1.GEORCOLL.ON.CA, Telephone: (705) 722-5106 Ext: 602             <><
--------------------------------------------------------------------------------

