Article 166284 of comp.os.vms:
Am I embarrassed!  I forgot to include DDU.COM file; here it is.

$set ter/wid=132
$HOLD_VERIFY = F$VERIFY()
$!!!SET NOVERIFY
$! This program is simply an alternate to   $SHOW DEVICE D
$!
$!	Brett C. Serkez			- June 11, 1984 -
$!	* * For Internal Digital Use Only * *
$!	Comments to PIGGY::SERKEZ or Brett Serkez @HUO
$!      Revised by Welch, U.Lowell to include RA90
$!	Revised by Welch, removing first 4 lines of device string (older
$!names) so that 255 characters will include more modern devices.
$!	Revised by DTL to handle dismounted devices better.
$!	Revised by LDYarbrough to handle dismounted devices
$!	V1.4 Highlight user's SYS$LOGIN device (LDY)
$!	V1.3 Revised Help information to reflect new version (BCS)
$!	V1.3 Added VMS V4 devices and optimized device name searching (SJM)
$!	V1.2 Revised for VMS V4 by Steve Munyan (XENON::)
$!	V1.1 Corrected HELP feature, label was in wrong place.
$!
$IF P1 .EQS. "HELP" .OR. P1 .EQS. "?" THEN GOTO TYPE_HELP
$!
$IF P1 .EQS. "" THEN GOTO SET_DISPLAY_TO_SCREEN
$!
$OPEN/WRITE/ERROR=OUTPUT_FILE_ERROR OUTPUT_FILE 'P1'
$DISPLAY := WRITE OUTPUT_FILE
$!
$GOTO GET_DISKS_INFO
$!
$SET_DISPLAY_TO_SCREEN:
$!	Set DISPLAY to screen, versus above which goes to "''P1'"
$DISPLAY := WRITE SYS$OUTPUT
$!
$ totfree = 0
$ totmax  = 1	! just so we do not divide by 0
$!
$GET_DISKS_INFO:
$!	Write temporary file to collect major disk info, 
$!	ON ERROR let them know.
$ON ERROR THEN GOTO TEMP_FILE_ERROR
$DEFINE/USER SYS$OUTPUT SYS$SCRATCH:DDU.TMP
$SHOW DEVICE D
$!
$OPEN/READ/ERROR=TEMP_FILE_ERROR INPUT_FILE SYS$SCRATCH:DDU.TMP
$!	On any errors, make sure files get closed and SYS$SCRATCH:DDU.TMP
$!	gets deleted.
$ON ERROR THEN GOTO READ_DONE
$!	Make NODE name look pretty.
$NODE_NAME = F$LOGICAL("SYS$NODE") - "::" - "_"
$	syslogin = F$GETDVI("SYS$LOGIN","DEVNAM")
$!	Tell them who you are, and what each column of data means.
$DISPLAY ""
$DISPLAY "DDU-V1.4 Disk Display Utility on ''NODE_NAME' at ''F$TIME()'."
$DISPLAY "Device              Used  Maximum     Free      Error Users
$DISPLAY "Name              Blocks   Blocks   Blocks      Count
$DISPLAY ""
$wr sys$output "[?7h"	!turn on word-wrap, I hope
$!
$!"RK06   RK07   RP04   RP05   RP06   RM03   RP07   RP07HT " + -
$!	      "RL01   RL02   RX02   RX04   RM80   TU58   RM05   RX01   " + -
$!              "ML11   RB02   RB80   RA80   RA81   RA60   RZ01   RC25   " + -
$!	      "RZF01  RCF25  RD51   RD53   RD26   RA82   RC26   RCF26  " + -
$DEV_STRING = "CRX50  RRD50  GEN_DU RX33   RX18   RA70   RA90   RD32   " + -
              "DISK9  RX35   RF30   RF71   RD33   ESE20  TU56   RZ22   " + -
              "RZ23   RZ24   RZ55   RRD40S RRD40  GEN_DK RX23   RF31   " + -
              "RF72   RAMDSK RZ25   RZ56   RZ57   RX23S  RX33S  RA92   " + -
              "SSTRIP RZ23L  RX26   RZ57I  RZ31   RZ58   RWZ01  RRD42  " + -
              "CD_LD_1ESE25  RFH31  RFH72  RF73   RFH73  RA72   RAH72  " + -
              "RF32   RFH32  RF31F  RZ72   RZ73   RZ35   RZ24L  RZ25L  " + -
              "RZ55L  RZ56L  RZ57L         " ! welch
$!
$READ_AGAIN:
	prefix = ""
	suffix = ""
$!
$!	Top of read and display data section, this is the meat of it all.
$READ/END_OF_FILE=READ_DONE INPUT_FILE DATA_LINE
$!
$ begin_name  = 0
$END_NAME=F$LOCATE(":","''DATA_LINE'")
$ if end_name .eq. f$length("''data_line'") then $ goto read_again
$!
$ name_start:
$ left_most = f$extract(begin_name, 1, "''data_line'")
$ if "''left_most'" .nes. " " THEN $ goto found_name
$ begin_name = begin_name + 1
$ goto name_start
$
$ found_name:
$!
$!	If the colon is further than 13 over, then it is not a disk name.
$IF END_NAME .GT. 13 THEN GOTO READ_AGAIN
$!
$!	Get actual disk name from line now that we know that it is there.
$DISK_NAME = F$EXTRACT(BEGIN_NAME, END_NAME - BEGIN_NAME, "''DATA_LINE'")
$!
$!	Get status to see if it's mounted or not.
$STATUS = ""
$!******* This is for VMS V4. for V3, replace "Mounted" with "mnt"
$IF F$LOCATE("Mounted",DATA_LINE) .EQ. F$LENGTH(DATA_LINE) THEN STATUS = "no"
$!	Get error count next as it needs no justification.
$ERR_CNT = F$GETDVI("''DISK_NAME'","ERRCNT")
$!
$! The DECIMAL equivalents were gotten out of the macro $DCDEF.  Numbers had
$! to be converted from HEXADECIMAL to DECIMAL for use here.  The list is
$! believed to be correct, but future versions of VMS may require upgrades
$! to this list.
$DEV_TYPE = F$GETDVI("''DISK_NAME'","DEVTYPE")
$DISP_DEV_TYPE := "Unknown"
$IF DEV_TYPE .LT.  1 THEN $ GOTO DEV_UNKNOWN
$IF DEV_TYPE .GT. 64+32 THEN $ GOTO DEV_UNKNOWN
$dev_type = dev_type - 32  ! because removed first 4 lines of device data
$!sho sym dev_type
$DEV_TEMP = (DEV_TYPE-1) * 7  ! each field is 7 chars wide
$!sho sym dev_temp
$DISP_DEV_TYPE = F$EXTRACT(DEV_TEMP, 7, "''DEV_STRING'")
$!sho sym disp_dev_type
$!
$DEV_UNKNOWN:		! Poorly named.  It should be DEV_TYPE_UNKNOWN:
$!
$!	Get maximum number of possible blocks, and build answer to 
$!	7 characters wide so that is appears neatly on the screen.
$MAX_BLOCKS_N = F$GETDVI("''DISK_NAME'","MAXBLOCK")
$ totmax = totmax + max_blocks_n
$MAX_BLOCKS = F$STRING("''MAX_BLOCKS_N'")
$MAX_BLOCKS = f$extract(0, 7 - f$length("''max_blocks'"), "        ") + "''MAX_BLOCKS'"
$!
$GET_FREE_BLOCKS:
$!	Get current total of free blocks, and build answer to
$!	7 characters wide so that it appears neatly on the screen.
$FREE_BLOCKS_N = F$GETDVI("''DISK_NAME'","FREEBLOCKS")
$USED_BLOCKS_N = MAX_BLOCKS_N - FREE_BLOCKS_N
$ totfree = totfree + free_blocks_n
$FREE_BLOCKS = F$STRING("''FREE_BLOCKS_N'")
$FREE_BLOCKS = f$extract(0, 7 - f$length("''free_blocks'"), "        ") + -
	"''free_blocks'"
$USED_BLOCKS = F$STRING("''USED_BLOCKS_N'")
$USED_BLOCKS = f$extract(0, 7 - f$length("''used_blocks'"), "        ") + -
	"''used_blocks'"
$!!! sho symb free_blocks
$!!! sho symb used_blocks
$!
$GET_DEVICE_NAME:
$!	Get device name, and build it to 18 characters to fit neatly on screen.
$DEV_NAME = F$GETDVI("''DISK_NAME'","DEVNAM")
$ if dev_name .eqs. syslogin THEN 	prefix = "[1m"
$ if dev_name .eqs. syslogin THEN 	suffix = "[0m"
$DEV_NAME = "''DEV_NAME'" + f$extract(0, 18-f$length("''dev_name'"), "            ")
$!
$COMPUTE_PERCENT:
$PERCENT_FREE_N = FREE_BLOCKS_N * 100 / MAX_BLOCKS_N
$IF max_blocks_n .LE. 0 THEN percent_free_n = 0
$PERCENT_FREE = "(" + F$STRING("''PERCENT_FREE_N'") + "%)"
$!
$!	Build percentage to 5 characters to fit neatly on the screen.
$ percent_free = f$extract(0, 5 - f$length("''percent_free'"), "     ") + -
	"''percent_free'"
$!
$Format_errors:
$Error_text = f$string("''Err_cnt'")
$ Error_text = f$extract(0, 4 - f$length("''Error_text'"), "    ") + -
	"''Error_text'"
$!start Welch, 930615
$ users := ""  
$!!!      sho sym dev_name
$ dev_name = dev_name - "_"
$!!! disk = dev_name - "_OAK$" - "_ASH$" - ":"
$ disk = dev_name - "OAK$" - "ASH$" - "WILLOW$" - "ASPEN$" - ":"
$ disk = disk - "TOPBOX$" - "LOWER$"
$ disk = f$edit( disk, "compress,trim")
$!!!      sho sym disk
$ if disk .eqs. "DSSI1$DIA1" then users := "dua13;manage,brecord,phone,sep97,jan98,jun98,jan99,muas$server-aspen"
$ if disk .eqs. "DSSI2$DIA4" then users := "dua4;dmw;mb,mr,muas$server-willow(nothing),pathworksMAC(lots)"
$ if disk .eqs. "DIA230" then users := "bkup,scratch,mx(ques),pathworksDOS,operator"
$ if disk .eqs. "DIA240" then users := "3rd party = APP_DISK,opteam,primary page&swap,mx(code,logs)"
$ if disk .eqs. "DIA250" then users := "engineer,kits,public,libarts,music,school,misc,00"
$ if disk .eqs. "DIA260" then users := "ed,faculty,hlth,sci,tbills"
$ if disk .eqs. "DIA310" then users := "95,sep96,jun97,research"
$ if disk .eqs. "DIA320" then users := "jan96,jun96,jan97,elect,sep98,jun99,sep99,01"
$ if disk .eqs. "DIA330" then users := "      SYSTEM DISK "
$ if disk .eqs. "DIA340" then users := "dce*,92-94,group,staff,2ndary page&swap"
$! end Welch, 930615
$!
$DISPLAY_INFO:
$!
$IF STATUS .EQS. "no" THEN FREE_BLOCKS = "  not"
$IF STATUS .EQS. "no" THEN PERCENT_FREE	= "mounted"
$DISPLAY -
$!"''prefix'''DEV_NAME'  ''DISP_DEV_TYPE' ''MAX_BLOCKS'    ",-  !no dev_type
"''prefix'''DEV_NAME'''USED_BLOCKS'  ''MAX_BLOCKS'  ",-
"''FREE_BLOCKS' ''PERCENT_FREE' ''Error_text'''suffix'",  -
" ",users		! Welch, 930615
$!
$GOTO READ_AGAIN
$!
$READ_DONE:
$ percentfree = (100*totfree)/totmax 
$!  Above will fail if numerator exceeds 2**31-1 = 2,147,483,647
$ percentused = 100 - percentfree
$! Attempting more accuracy:
$!!! sho sym totfree
$!!! sho sym totmax
$   numerator = totfree
$   denom     = totmax/10000
$   ans       = numerator/denom
$!!!   sho sym numerator
$!!!   sho sym denom
$!!!   sho sym ans
$   remainder = ans - ( (ans/100)*100)
$!!!   sho sym remainder
$DISPLAY " "
$DISPLAY "Overall percent free = ", percentfree, -
";           Probably more accurately: ", percentfree,".",remainder
$DISPLAY "Overall percent used = ", percentused
$!
$CLOSE INPUT_FILE
$!	Quietly delete temporary file when done.
$DELETE/NOLOG/NOCONFIRM SYS$SCRATCH:DDU.TMP.*
$!	If there is an open output file, close it.
$IF P1 .NES. "" THEN CLOSE OUTPUT_FILE
$!	If there is an output file, tell them that is is created.
$IF P1 .NES. "" THEN WRITE SYS$OUTPUT "%DDU-S-SUCCESS, File ''P1' created..."
$!
$COMMON_EXIT:
$!	Reset verify to user's original specification.
$RESET_VERIFY = F$VERIFY('HOLD_VERIFY')
$ inq dummy "Press CR to continue"
$ set term/wid=80
$ @app_disk:[tools]headerfull dia1		!for a while, because nearly full
$!
$EXIT
$!
$OUTPUT_FILE_ERROR:
$!
$WRITE SYS$OUTPUT "%DDU-F-FATAL, Error opening file ''P1', try again..."
$!
$GOTO COMMON_EXIT
$!
$TEMP_FILE_ERROR:
$!
$WRITE SYS$OUTPUT "%DDU-F-FATAL, Error opening temporary file, investigate..."
$!
$GOTO COMMON_EXIT
$!
$TYPE_HELP:
$!	The following command will type everything that appears after it
$!	until it finds a dollar sign in the first position.
$TYPE SYS$INPUT:

    DDU-V1.4 Disk Display Utility is a VMS command file to display summary
information about the disks on a VMS machine.  It uses SHOW DEVICE D to
obtain the names of the devices.  Then it uses F$GETDVI to get specific
information on each disk, computing the percentage of free space.  The
device type is converted from a decimal digit to a character string using
information resident in the macro $DCDEF for each disk. The device which is
the user's SYS$LOGIN device is highlighted using VT100 escape sequences. 

    DDU optionally accepts three parameters.  The first two are HELP and ?,
which cause this message to appear.  The third is any valid VMS file
specification.  If a file is specified, the information that would normally
appear on the screen will be directed to the specified file. 

    To use DDU simply type @DDU.COM<CR> or define a symbol to do this for
you, i.e. DDU :== @DEV:[ACCNT]DDU.COM. 

    Examples(Assumes that the symbol DDU was defined as stated above):

    $DDU<CR>

    DDU-V1.4 Disk Display Utility on PIGGY at  5-JUL-1984 08:21:22.06.
    Device          Device     Maximum      Free      Percent    Error
    Name            Type       Blocks       Blocks    Free       Count

    [1m_DRA0:          RM05        500384      141120     28%          0[0m
    _DRA1:          RM05        500384      127431     25%          0
    _DRB2:          RM05        500384      226056     45%          0
    _DRB3:          RM05        500384       28161      5%          1
    $

    $DDU ?<CR> or DDU HELP<CR>
    		this HELP message 
    $

    $DDU SAVDSKINF.DAT<CR>
    %DDU-S-SUCCESS, File SAVDSKINF.DAT created...
    $

    ERROR MESSAGES:
    
    %DDU-F-FATAL, Error opening file SAVDSKINF.DAT try again...

 	The file name passed to the utility was invalid for some reason,
    check the name and try again.   
 
    %DDU-F-FATAL, Error opening temporary file, investigate...

    	A temporary file is created to collect the information from the
    DCL command SHOW DEVICE D.  There is a problem with the specification
    used. The current file specification used is: SYS$SCRATCH:DDU.TMP.

[END OF HELP]
$!
$GOTO COMMON_EXIT
-- 
Brendan Welch, system analyst, UMass/Lowell, W1LPG,  welchb@woods.uml.edu


