[mod.computers.vax] "You have 2 mail messages waiting"

xrjjm%csdr.span@JPL-VLSI.ARPA.UUCP (04/06/87)

Comment:   Begin User Supplied Mail Headers.
*Site:     NASA Goddard Space Flight Center - Greenbelt, Maryland, USA.
*From:     John J. McMahon, Systems Programmer, STX - ST Systems Corporation.
*Project:  COBE Science Data Room (CSDR), Code 401.1
*Reply-To: (Arpa-Internet)       XRJJM%CSDR.SPAN@JPL-VLSI.ARPA
*Reply-To: (Bitnet)              ZMJJM@SCFVM
*Reply-To: (Span/Physnet/Hepnet) 6173::XRJJM = CSDR::XRJJM (Node 6.29)
*Reply-To: (TEXnet)              UTADNX::UTSPAN::CSDR::XRJJM

Unfortunately, the documenation of the 2 primary MAIL files 
(SYS$SYSTEM:VMSMAIL.DAT and MAIL.MAI) is severely lacking, the information
I have was derived from the fiche.

Anyhow SYS$EXAMPLES:MAILUAF.COM is a good basis for getting info out
of VMSMAIL.DAT (And the number of new mail messages is stored in there).
I would advise that if you are using MAILUAF that you remove the /WRITE
qualifiers from the OPEN statements (Better safe than sorry).

This is an excerpt from a program I posted to INFO-VAX recently,
It should report back all of the messages currently waiting.
(Usual disclaimers apply).

$ User[0,31] := 'F$GETJPI(0,"USERNAME")'
$ sysmail = "SYS$SYSTEM:VMSMAIL.DAT"
$ open /share /read  file 'sysmail' 
$ read /index=0  /key="''User'" file record
$ MESSAGES = F$CVUI(33*8,8,RECORD)
$ WRITE Sys$Output "You have ",messages," messages waiting."
$ Close file

Hope this helps the Vanilla VMS mail folk out!
Regards,
^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
John J. McMahon (Fast-Eddie)                     
Disclaimer: Views expressed in this letter are my own, 
            and are not meant to represent the views of my employers.