Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CREATE A COMMAND FILE TO CALCULATE DISKSPACE, FREESPACE...

25 views
Skip to first unread message

David Alvarez

unread,
Feb 19, 1997, 3:00:00 AM2/19/97
to

Hello,

I'm trying to create a command file that check for the disks total,
free disk , and percentage used and calculates the total in
megabytes. I want to exclude the fisical shawdowset members.

Thanks
David

Joseph Gill

unread,
Feb 23, 1997, 3:00:00 AM2/23/97
to

David Alvarez (Dav...@shsmail.stanford.edu) wrote:
: Hello,

: Thanks
: David

Here's the one I use. The results look like this;

You are on a VAX 4000-500 named AFT410 running Version V5.5-2 of OpenVMS.
It was last booted on 19-NOV-1996 07:48:09.71.
This system contains the following disks:
REL16 : % free 41 : total free 856698 (1001MB)
DISK1 : % free 10 : total free 177417 (812MB)
DISK14 : % free 12 : total free 206976 (812MB)
DISK2 : % free 12 : total free 250782 (954MB)
DISK3 : % free 4 : total free 89661 (954MB)
DISK10 : % free 15 : total free 255255 (812MB)
DISK33 : % free 15 : total free 321960 (1001MB)
DISK31 : % free 6 : total free 567675 (4091MB)
DISK32 : % free 11 : total free 976923 (4091MB)
DISK30 : % free 6 : total free 277572 (2007MB)
DISK40 : % free 47 : total free 1935912 (2007MB)
DISK11 : % free 14 : total free 238884 (812MB)
BASVAX : % free 77 : total free 1285884 (812MB)

This system contains total 20GB
This system contains total free 3GB

This system contains the following tape drives:
_$1$MUA0: type: TK70 is available
_$1$MUB0: type: TU81 is used by [AFTECH].
_$1$MKA200: type: TZ30 is available
_$1$MKA400: type: TSZ07 is available
_$1$MIA2: type: TF85 is available

Here is the DCL command procedure;

$!***************************************************************************
$!
$! DISKS.COM
$!
$! Written: March, 1993 by J. Gill
$!
$! This command procedure will check disk and tape
$! utilization.
$!$!***************************************************************************
$!
$!---------------------------------------------------------------------------
$! Set up symbols.
$!---------------------------------------------------------------------------
$!
$ BLANK = " "
$ SAY := WRITE SYS$OUTPUT
$!
$ SAY "You are on a ",F$GETSYI("HW_NAME"), " named " -
,F$GETSYI("NODENAME"), " running Version " -
,F$EDIT(F$GETSYI("VERSION"),"TRIM")," of OpenVMS."
$
$ SAY "It was last booted on ",F$GETSYI("BOOTTIME"),"."
$!
$ MAX_MB = 0
$ TOTAL_FREE_MB = 0
$ TOTAL_MB = 0
$!
$!---------------------------------------------------------------------------
$! Check disk drives.
$!---------------------------------------------------------------------------
$!
$ SAY "This system contains the following disks:"
$DISKLOOP:
$ VOLUME_SPACES = 12
$ BLOCK_SPACES = 8
$ PERCENT_SPACES = 3
$ MB_SPACES = 8
$ DISK = F$DEVICE(,"DISK")
$ IF DISK .EQS. "" THEN GOTO TAPE
$ MOUNTED = F$GETDVI("''DISK'","MNT")
$ IF MOUNTED .EQS. "FALSE" THEN GOTO DISKLOOP
$ TAPE_NAME = F$GETDVI(DISK,"VOLNAM")
$ FREE_TAPE_NAME = F$LENGTH(TAPE_NAME)
$ VOLUME_SPACES = VOLUME_SPACES - FREE_TAPE_NAME
$ VOLUME_BLANKLINE = F$EXTRACT(0,'VOLUME_SPACES',BLANK)
PERCENT_FREE = -
F$GETDVI(DISK,"FREEBLOCKS")/(F$GETDVI(DISK,"MAXBLOCK")/100)
$ FREE_PERCENT_FREE = F$LENGTH(PERCENT_FREE)
$ PERCENT_SPACES = PERCENT_SPACES - FREE_PERCENT_FREE
$ PERCENT_BLANKLINE = F$EXTRACT(0,'PERCENT_SPACES',BLANK)
$ FREE_BLOCK = F$GETDVE(DISK,"FREEBLOCKS")
$ FREE_MB = FREE_BLOCK/2048
$ TOTAL_FREE_MB = FREE_MB + TOTAL_FREE_MB
$ FREE_BLOCK_LENGTH = F$LENGTH(FREE_BLOCK)
$ BLOCK_SPACES = BLOCK_SPACES - FREE_BLOCK_LENGTH
$ BLOCK_BLANKLINE = F$EXTRACT(0,'BLOCK_SPACES',BLANK)
$ MAX_BLOCKS = F$GETDVE(DISK,"MAXBLOCK")
$ MAX_MB = MAX_BLOCKS / 2048
$ TOTAL_MB = TOTAL_MB + MAX_MB
$ FREE_MAX_MB = F$LENGTH(MAX_MB)
$ MB_SPACES = MB_SPACES - FREE_MAX_MB
$ MB_BLANKLINE = F$EXTRACT(0,'MB_SPACES',BLANK)
$ SAY "''TAPE_NAME'''VOLUME_BLANKLINE' : % free
''PERCENT_BLANKLINE'" + -
"''PERCENT_FREE' : total free ''BLOCK_BLANKLINE'''FREE_BLOCK'"
+ -
"''MB_BLANKLINE'(''MAX_MB'MB)"
$ GOTO DISKLOOP
$!
$!
$!---------------------------------------------------------------------------
$! Check tape drives.
$!---------------------------------------------------------------------------
$!
$TAPE:
$ TOTAL_GB = TOTAL_MB/1000
$ TOTAL_FREE_GB = TOTAL_FREE_MB/1000
$ SAY ""
$ SAY "This system contains total ''TOTAL_GB'GB"
$ SAY "This system contains total free ''TOTAL_FREE_GB'GB"
$ SAY ""
$ SAY "This system contains the following tape drives:"
$TAPELOOP:
$!
$ DEVNAME_SPACES = 17
$ DEVTYPE_SPACES = 8
$ TAPE = F$DEVICE(,"TAPE")
$ IF TAPE .EQS. "" THEN GOTO EXIT
$ FREE_DEVNAME_LENGTH = F$LENGTH(TAPE)
$ DEVNAME_SPACES = DEVNAME_SPACES - FREE_DEVNAME_LENGTH
$ DEVNAME_BLANKLINE = F$EXTRACT(0,'DEVNAME_SPACES',BLANK)
$ OWNER = F$GETDVI("''TAPE'","PID")
$ IF OWNER .EQS. ""
$ THEN
SAY TAPE, "''DEVNAME_BLANKLINE' type:
",F$GETDVI(TAPE,"MEDIA_NAME"),
" is available"
$ ELSE
$ OWN_BY = F$GETDVI("''TAPE'","OWNUIC")
$ SAY TAPE, "''DEVNAME_BLANKLINE' type:
",F$GETDVI(TAPE,"MEDIA_NAME"),
-
" is used by ''OWN_BY'."
$ ENDIF
$ GOTO TAPELOOP
$!
$!---------------------------------------------------------------------------
$! Exit the command procedure.
$!---------------------------------------------------------------------------
$!
$EXIT:
$ EXIT

David P. Murphy

unread,
Feb 24, 1997, 3:00:00 AM2/24/97
to

fine, everyone's doing it, why not me?

$ free
Total Percentage
Disk Blocks Used Free Available Errors
-------------- ------- ------- ------- ---------- ------
_CONNOR$DKA100: 4110480 2172228 1938252 47.15% 0
_CONNOR$DKA300: 2050860 1700691 350169 17.07% 0
_CONNOR$DKA400: 2050860 1750468 300392 14.63% 0
_CONNOR$DKA600: 2050860 1988892 61968 2.97% 0 system
-------------- ------- ------- ------- ---------- ------
Totals 10263060 7612279 2650781 25.82% 0
$ free * /m
Total Percentage
Disk Megs Used Free Available Errors
-------------- ------- ------- ------- ---------- ------
_CONNOR$DKA100: 2007 1060 946 47.15% 0
_CONNOR$DKA300: 1001 830 170 17.07% 0
_CONNOR$DKA400: 1001 854 146 14.63% 0
_CONNOR$DKA600: 1001 971 30 2.97% 0 system
-------------- ------- ------- ------- ---------- ------
Totals 5011 3716 1294 25.82% 0
$

$ save_ver = 'f$verify(0)'
$ on warning then goto LEAVE
$ on control_y then goto LEAVE
$!
$! SHOW FREE SPACE FOR ONE OR MORE DISKS
$!
$! P1 is an (optional) comma-delimited list of disks to display
$! the default is all accessible disks
$! P2 is an (optional) qualifier specifying the units: /KILOBYTES /MEGABYTES /GIGABYTES
$! the default is blocks (i.e., 512 bytes)
$!
$ ws := write sys$output
$!
$ INIT:
$ totmax = 0
$ totfree = 0
$ totused = 0
$ totdiv = 0
$ totmod = 0
$ toterr = 0
$ index = 0
$ delimiter = ","
$ show_kils = (f$extract(0, 2, p2) .eqs. "/K")
$ show_megs = (f$extract(0, 2, p2) .eqs. "/M")
$ show_gigs = (f$extract(0, 2, p2) .eqs. "/G")
$ sysdisk = f$getdvi("SYS$SYSDEVICE:", "FULLDEVNAM")
$ UCB$M_TEMPLATE = %x2000
$!
$ index = 0
$ disk_list = p1
$ if disk_list .eqs. "*" then disk_list = ""
$ gosub WRITE_HEADER
$!
$ SHOW_LOOP:
$ if disk_list .eqs. ""
$ then
$ curdisk = f$device(, "DISK")
$ else
$ curdisk = f$element(index, delimiter, disk_list)
$ endif
$ if curdisk .eqs. delimiter .or. curdisk .eqs. ""
$ then
$ curdisk = ""
$ gosub SHOW_TOTALS
$ goto LEAVE
$ endif
$ index = index + 1
$ if f$getdvi(curdisk, "EXISTS")
$ then
$ if (f$getdvi(curdisk, "STS") .and. UCB$M_TEMPLATE) .eq. 0
$ then
$ name = f$getdvi(curdisk, "FULLDEVNAM")
$ len = 20 - f$length(name)
$ if f$getdvi(curdisk, "DEVCLASS") .eq. 1
$ then
$ gosub ZERO_OUT
$ gosub CALCULATE
$ gosub UPDATE_TOTALS
$ gosub WRITE_LINE
$ else
$ ws f$fao("!#AS!AS <not a disk>", len, " ", name)
$ endif
$ endif
$ else
$ name = curdisk
$ len = 20 - f$length(name)
$ ws f$fao("!#AS!AS <no such device>", len, " ", name)
$ endif
$ goto SHOW_LOOP
$!
$ ZERO_OUT:
$ used = 0
$ free = 0
$ div = 0
$ mod = 0
$ errcnt = 0
$ return
$!
$ CALCULATE:
$ max = f$getdvi(curdisk, "MAXBLOCK")
$ if max .eq. 0 then return
$ free = f$getdvi(curdisk, "FREEBLOCKS")
$ errcnt = f$getdvi(curdisk, "ERRCNT")
$ used = max - free
$ gosub CALC_PERCENTAGE
$ return
$!
$ CALC_PERCENTAGE:
$ div = 0
$ mod = 0
$ if max .eq. 0 then return
$ if max .gt. 1000000
$ then
$ if free .lt. 1000
$ then
$ free_percent = 0
$ else
$ tmpmax = max / 1000
$ tmpfree = free / 1000
$ free_percent = tmpfree * 1000 / (tmpmax / 10)
$ endif
$ else
$ free_percent = free * 1000 / (max / 10)
$ endif
$ div = free_percent / 100
$ mod = free_percent - div*100
$ return
$!
$ UPDATE_TOTALS:
$ totmax = totmax + max
$ totfree = totfree + free
$ totused = totused + used
$ totdiv = totdiv + div
$ totmod = totmod + mod
$ toterr = toterr + errcnt
$ return
$!
$ WRITE_HEADER:
$ units = "Blocks"
$ if show_kils then units = " K"
$ if show_megs then units = " Megs"
$ if show_gigs then units = " Gigs"
$ ws " Total Percentage"
$ ws " Disk ''units' Used Free Available Errors"
$ ws " -------------- ------- ------- ------- ---------- ------"
$! _DRA0: xxxxxxx xxxxxxx xxxxxxx xx.xx% xxx
$! _DUA0: xxxxxxx xxxxxxx xxxxxxx xx.xx% xxx
$ return
$!
$ WRITE_LINE:
$ if show_kils .or. show_megs .or. show_gigs
$ then
$! ---- convert "blocks" (512 bytes) into "kils" (1024 bytes)
$ max = max / 2
$ free = free / 2
$ used = used / 2
$ if show_megs .or. show_gigs
$ then
$ max = max / 1024
$ free = free / 1024
$ used = used / 1024
$ if show_gigs
$ then
$ max = max / 1024
$ free = free / 1024
$ used = used / 1024
$ endif
$ endif
$ endif
$ special = ""
$ if curdisk .nes. ""
$ then
$ if name .eqs. sysdisk then special = " system"
$ if f$getdvi(curdisk, "SWL") then special = " readonly"
$ if f$getdvi(curdisk, "SHDW_MEMBER") then special = " shadow"
$ endif
$ ws f$fao("!#AS!AS !9SL !9SL !9SL !3SL.!2ZL%!8SL!AS", len, " ", name, max, used, free, div, mod, errcnt, special)
$ return
$!
$ SHOW_TOTALS:
$ ws " -------------- ------- ------- ------- ---------- ------"
$ len = 14
$ name = "Totals"
$ max = totmax
$ free = totfree
$ used = totused
$ errcnt = toterr
$ gosub CALC_PERCENTAGE
$ gosub WRITE_LINE
$ return
$!
$ LEAVE:
$ exit 1 + 0 * f$verify(save_ver)

ok
dpm
--
David P. Murphy mailto:mur...@connor.datametrics.com (work)
systems programmer mailto:d...@access.digex.net (personal)
http://www.access.digex.net/~dpm
COGITO ERGO DISCLAIMUM ftp://ftp.access.digex.net/pub/access/dpm

Brendan Welch, W1LPG

unread,
Feb 24, 1997, 3:00:00 AM2/24/97
to

And here is yet another, DDU.COM (Disk Display Utility), a munging of
something which originally came from DEC unofficially.
It has 3 strange additions, which you should easily find and edit:

1) quickie description of what locally is on our disks; I find this very useful
for my tired brain. I not only run DDU several times a day for its
original intent, but also to help me find out where I want to look
for something.
2) uses 132 columns, in order to fit in #1
3) at the end, keeps an eye on problem disk whose headers are almost full
(I think the code it refers to is not included).
--
Brendan Welch, system analyst, UMass/Lowell, W1LPG, wel...@woods.uml.edu

Brendan Welch, W1LPG

unread,
Feb 24, 1997, 3:00:00 AM2/24/97
to

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

0 new messages