From: chris@CSVAX1.UCC.IE ("J.C. Higgins, Sys Mgr CsVax1, UCC , Eire")
Newsgroups: comp.os.vms
Subject: RE: Disk quota report facility wanted?
Date: 27 Aug 92 18:33:51 GMT
Distribution: world
Organization: The Internet

I stuck together the following little routine to do part of what you need.
It's not very fast, but it does the job.
It reports the name of users who have used over 90% of their diskquota.
This also includes people who have exceeded their quota..
As for a top ten listing, won't that always be your top ten most important
users. I mean that SYSTEM should be close to the top... Then the local
system programmer.. etc... So if you want to filter that information you
could modify the following routine..

                                                  Chris.

+ J.C. Higgins, Sys Admin  +  If you love something, set it free. If it doesn't
+ CHRIS@csvax1.ucc.ie      +  come back to you, hunt it down and KILL it. If
+ SCCS6002@iruccvax.ucc.ie +  that doesn't work, then GIVE UP peacefully.

$! QUOALL
$! ------
$! Routine to list ALL users that have used more than 90% of their disk quota
$       v = 'f$VERIFY(0)'
$
$       SET ON
$       ON CONTROL_Y THEN GOTO ABORT
$
$       prev_priv = F$SETPRV("SYSPRV")
$       test = F$PRIVILEGE("SYSPRV")
$       IF test .NES. "TRUE" THEN GOTO NOT_AUTHORIZED
$
$       vmsquotafile = "userquota.list"
$       say   = "WRITE SYS$OUTPUT"
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$  USER     = ""
$  QUOTA    = 0
$  MAXQUOTA = 0
$  DISKQUOTA := $DISKQUOTA
$  DEFINE/USER sys$output 'vmsquotafile'
$  DiskQuota
          sho *
     exit
$
$       OPEN /READ /ERROR=ABORT  quofile  'vmsquotafile'
$
$! Skip DISKQUOTA header.
$       READ/END=DONE /ERR=ERRORS  quofile  record
$
$       say "   User               Quota     MaxQuota"
$
$LOOP:
$       READ/END=DONE /ERR=ERRORS  quofile  record
$       user = f$EXTRACT(0,17,record)
$       temp = f$integer(f$extract(18,1,record))
$       if ((temp .eq. 0) .and. (f$extract(18,1,record) .nes. "0")) then goto SK
   PLN
$       if ((temp .ge. 0) .and. (temp .le. 9)) then goto LBRK
$SKPLN:
$       READ/END=DONE /ERR=ERRORS  quofile  record
$LBRK:
$       quota = f$INTEGER(F$EXTRACT(18,10,record))
$       maxquota = f$INTEGER(F$EXTRACT(31,10,record))
$       IF (quota * 10) .LE. (maxquota * 9)  THEN GOTO LOOP
$       say user, "     ", quota , "        " , maxquota
$       GOTO LOOP
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ERRORS:
$       say ""
$       say "??? problems reading file ", vmsquotafile
$       say ""
$       GOTO ABORT
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$NOT_AUTHORIZED:
$       say " "
$       say " !!! Sorry - you do not have the required privilege."
$       say " "
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ABORT:
$!      GOTO DONE
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$DONE:
$       IF f$TRNLNM("quofile") .NES. "" THEN CLOSE quofile
$       delete/nolog/noconf 'vmsquotafile';*
$       prev_priv = F$SETPRV(prev_priv)
$       EXIT 1.OR.f$VERIFY(v)
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$HELP:  TYPE SYS$INPUT

QUOALL
******

Routine to list ALL users that have used more than 90% of their diskquota.

Usage
        @QUOALL
                Lists the Quota status for ALL users on the screen


$       EXIT 1.OR.f$VERIFY(v)
$
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ J.C. Higgins (16-5-92) University College Cork. <chris@csvax1.ucc.ie>
$ This program is mine, the format of the COM file is one
$ used by 'the GODs upstairs'. The top 'GOD' being  J.F. Murphy.
$ Did I say GOD,.. should that be DOG ?? Well who knows...
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!