$! ********************************************************************** $! * DISK_SPACE.COM * $! * Display all disks on the system. For mounted disks, also * $! * display size and free space info. * $! * * $! * If P1 is "PAGE", display one screenful at a time. Otherwise, * $! * use continuous display. * $! * * $! * The symbol Space_Threshold defines the threshold value for * $! * highlighting each disks capacity column. If a disk's capacity * $! * as a percentage full value is greater than or equal to this * $! * symbol, the symbol Space_Hilite is applied to the capacity col. * $! * * $! * 14-OCT-1993 RDJ Command Procedure Creation. * $! * * $! * 16-JAN-1997 RDJ Ignore shadow and stripe set members - * $! * master is already reported on! * $! * * $! * 06-DEC-1999 RDJ Modified megabyte calculations to * $! * prevent DCL integer overflow. * $! ********************************************************************** $! $ Esc[0,8] = 27 ! define escape value (do not change) $ Space_Threshold == 90 ! threshold for blinking (percent full) $ Space_Hilite == ESC + "[5m" ! string to hilite capacity over threshold $! ********************************************************************** $ WO == "Write SYS$OUTPUT" $ Total_Size == 0 ! total size counter $ Lines = 1 ! line counter $ Max_Lines = F$GetDvi("SYS$OUTPUT","TT_Page") - 3 $ Page_Display = "FALSE" $ If F$Edit(P1,"Trim,UpCase") .EQS. "PAGE" Then Page_Display = "TRUE" $ If Page_Display Then Type/Page NL: $ Page_Header = Esc + "[1mPhysical Name Volume Name Type Err Size Free Used Cap"+Esc+"[0m" $ WO Page_Header $! $ Get_Next_Disk: $ Disk_Name = F$Device("*","Disk") $ If Disk_Name .EQS. "" Then - Goto No_More_Disks $ If F$GetDvi(Disk_Name,"Shdw_Member") Then Goto Get_Next_Disk $ If F$GetDvi(Disk_Name,"VolCount") .GT. 1 Then Goto Get_Next_Disk $ If (Page_Display) .AND. (Lines .EQ. Max_Lines) $ Then $ Write SYS$OUTPUT "" $ Read/Prompt=" Press [RETURN] to Continue" SYS$COMMAND Nada $ Type/Page NL: $ WO Page_Header $ Lines = 1 $ EndIf $ If F$GetDvi(Disk_Name,"Mnt") $ Then $ Call Show_Mounted 'Disk_Name' $ Else $ Call Show_UnMounted 'Disk_Name' $ EndIf $ Lines = Lines + 1 $ Goto Get_Next_Disk $! $ No_More_Disks: $ WO "" $ If Total_Size .GT. 1024 $ Then $ Size_GB = Total_Size/1024 $ Size_MB = Total_Size - (1024*Size_GB) $ Write SYS$OUTPUT "Total mounted disk space: ''Size_GB'.''Size_MB' gb." $ Else $ Write SYS$OUTPUT "Total mounted disk space: ''Total_Size' mb." $ EndIf $ Exit $! $! ********************************************************************** $! * Show_Mounted: Display a Mounted Disk Volume. * $! * P1 = Name of disk to display. * $! ********************************************************************** $ Show_Mounted: SubRoutine $ Hilite = "" $ Lolite = ESC + "[0m" $ Max_Blocks = F$GetDvi(P1,"MaxBlock") $ Free_Blocks = F$GetDvi(P1,"FreeBlocks") $ Max_Size = Max_Blocks/2/1024 $ Total_Size == Total_Size + Max_Size $ Free_Size = Free_Blocks/2/1024 $ Used_Size = Max_Size - Free_Size $ Capacity = Used_Size*100/Max_Size $ If Capacity .GE. Space_Threshold Then Hilite = Space_Hilite $ WO F$FAO("!14AS !15AS !4AS !3UL !6ULmb !6ULmb !6ULmb !AS!3UL%!AS", - P1,F$GetDvi(P1,"VolNam"),F$GetDvi(P1,"Media_Name"),F$GetDvi(P1,"ErrCnt"), - Max_Size,Free_Size,Used_Size,Hilite,Capacity,LoLite) $ Exit $ EndSubRoutine ! Show_Mounted $! $! ********************************************************************** $! * Show_UnMounted: Display a Unmounted Disk Volume. * $! * P1 = Name of disk to display. * $! * Since most information cannot be gotten from an unmounted disk, * $! * display only the media type and error count. * $! ********************************************************************** $ Show_UnMounted: SubRoutine $ WO F$FAO("!14AS (not mounted) !4AS !3UL", - P1,F$GetDvi(P1,"Media_Name"),F$GetDvi(P1,"ErrCnt")) $ Exit $ EndSubRoutine ! Show_UnMounted