From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 25-AUG-1989 14:48
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RE: Format of record in VMSMAIL_PROFILE.DATA?

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 25 AUG 89 10:27:31 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Fri, 25 Aug 89 10:11:04 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA09462; Fri, 25 Aug 89 10:04:11 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 17 Aug 89 16:42:13 GMT
From: brutus.cs.uiuc.edu!wuarchive!kuhub.cc.ukans.edu!zeus!sysprg@apple.com  (Craig B. Walter)
Subject: RE: Format of record in VMSMAIL_PROFILE.DATA?
Message-Id: <3197@zeus.unl.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

>I'm trying to persuade a command procedure which worked under VMS 4 to
>do the same under VMS 5.  This procedure needs to know how many unread
>new MAIL message are pending.  The current (semi-converted code) is
>
>$ open/share=write/read input sys$system:vmsmail_profile.data
>$ read/index=0/key="''username'" input record
>$ close input
>$ newmail_count = f$cvsi(33*8,16,record)
>
>I don't know where the magic numbers came from.  The format of this file
>is not, as one might expect, documented in any of the VMS manuals...and
>the site I'm doing the work for can't afford the fiche.
>
>Can anyone out there tell me the format of this accursed data file?

        Well, here is a command file I wrote and it works pretty well.
        You can either supply somebody elses username, a logical name
        which translates to somebody elses username, or no paramater at
        all which makes it default to your own username.


$!   Programmer:  Craig Walter    @ZEUS.UNL.EDU
$! 
$!      This command file accesses the SYS$SYSTEM:VMSMAIL_PROFILE.DATA
$!      file, which is a new file under VMS 5.0, and extracts the number
$!      of new mail messages a user currently has.  This is run from the
$!      command line so that a person need not enter mail to see if they
$!      have any new messages.
$!
$!      Note that this command file either accepts a username as a parameter
$!      or it will default to the username of the person running it.
$!      This of course requires privs to open the VMSMAIL_PROFILE.DATA file. 
$!       
$!
$ prev_priv = f$setprv("SYSPRV")                             ! check for required privs
$ sysmai = "SYS$SYSTEM:VMSMAIL_PROFILE.DATA"                 ! mail file name
$ open /share=write /read/write f1 'sysmai'                  ! open the mail file
$ if p1 .eqs. "" then $ p1 = f$edit (f$getjpi (0, "USERNAME"), "TRIM")  ! use your own account
$ fulluser[0,31]:='p1'                              
$ loguser = f$trnlnm (f$edit(fulluser, "TRIM"))     ! this translates the input paramter if it is a logical name
$ if loguser .eqs. "" then loguser = f$edit(fulluser, "TRIM")
$ read /index=0 /err=nosuchuser /key="''loguser'" f1 record   ! read the users record
$ newmail = f$cvui(35*8,1*8,record)                           ! grab the number of new mail messages
$ write sys$output "User ",loguser,", has ",newmail," new mail messages..."
$ goto done
$nosuchuser:
$ write sys$output "User ",p1," does not exist!!!"
$done:
$ close f1
$ prev_priv = f$setprv(prev_priv)
$ exit


       Craig Walter

