$!............................................................................. $! VAX/VMS archive file created by VMS_SHARE V06.00 26-May-1988. $! $! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from $! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au). $! $! To unpack, simply save, concatinate all parts into one file and $! execute (@) that file. $! $! This archive was created by user PJS $! on 27-MAY-1990 12:38:57.47. $! $! It contains the following 1 file: $! DISK_USE.COM $! $!=============================================================================== $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK $ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", - "VMS_SHARE V06.00 26-May-1988 requires VMS V4.4 or higher." $ EXIT 44 $VERSION_OK: $ GOTO START $ $UNPACK_FILE: $ WRITE SYS$OUTPUT "Creating ''FILE_IS'" $ DEFINE/USER_MODE SYS$OUTPUT NL: $ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION - VMS_SHARE_DUMMY.DUMMY b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) ) ; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE , b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors := 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION ( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := "" ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF ; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip < > 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE ) ; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION ( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 ) ; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE ( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF ; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL ( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line < > 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF ; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT ( "The following line could not be unpacked properly:" ); SPLIT_LINE ; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`" , FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 ) ; IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII ( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET ( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) ) ; COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS" , i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors , "SYS$COMMAND" ); ENDIF; EXIT; $ DELETE VMS_SHARE_DUMMY.DUMMY;* $ CHECKSUM 'FILE_IS $ WRITE SYS$OUTPUT " CHECKSUM ", - F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." ) $ RETURN $ $START: $ FILE_IS = "DISK_USE.COM" $ CHECKSUM_IS = 1497539002 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ `009verify_on = f$verify(0) X$ `009IF p1 .nes. "?" THEN GOTO start X$ `009type sys$input X DISK_USE.COM X XThis command procedure will summarize the disk usage on a given RMS volume. X XIt generates a report in SYS$SCRATCH:DISK_USE.LIS which consists of Xheaded pages containing one line for each UIC represented in the quota Xfile on that volume. UICs consuming no blocks on that volume are not listed. X XEach line contains the following information: X X`009The username `009`009`009(e.g. "PJS"); X`009The personal name `009`009(e.g. "Peter Scott"); X`009The number of blocks used by them on that volume; X`009Their permanent quota on that volume; X`009Their usage as a percentage of the available disk space; X`009Their quota as a percentage of the available disk space; X`009Their UIC`009`009`009(e.g. "[NAVDEV,PJS]"). X XRelevant fields are totalled at the bottom, including the maximum Xnumber of blocks available on the volume. The totals for the Xpercentages are calculated from other information to avoid rounding Xerror. X XUsage: X`009$ @DISK_USE`009 X XIf you do not supply the volume name you will be prompted for it Xuntil you do. This can be any string that DISKQUOTA can use. It Xdoes not matter whether you append a colon. X XExample: X`009$ @DISK_USE`009USER$DISK: X XDISK_USE needs to be able to create, write, and delete files in the Xdirectory SYS$SCRATCH, and to set that as the default directory. XAt the end of running the procedure SYS$SCRATCH will be the current Xdirectory. When run from an interactive session on a lightly loaded Xmachine, DISK_USE will take about 15 minutes to complete if 150 users Xhave quotas on the specified volume. X XSome UICs may not have an associated user; these are flagged as "UNKNOWN". XThe system manager may have wanted files to be owned by a hypothetical Xuser and so assigned them to a UIC without a matching record in the Xsystem authorization file. X XThis command procedure requires the privileges BYPASS and SYSPRV, and Xat least 500 free blocks of disk quota in SYS$SCRATCH. X X`009`009`009`009`009Author: Peter Scott (GROUCH::PJS) X$`009EXIT X$ start: X$`009ON control_Y THEN GOTO interrupt X$`009IF p1 .nes. "" THEN GOTO okay X$`009IF f$mode() .nes. "INTERACTIVE" THEN GOTO honk X$`009inquire/nopunctuation p1 "_DISK: " X$`009IF p1 .eqs. "" THEN GOTO start X$ okay: X$`009disk = p1 - ":" X$`009ON error THEN GOTO error X$`009old_priv = f$setprv("SYSPRV,BYPASS") X$ `009IF f$privilege("NOSYSPRV") .or. f$privilege("NOBYPASS") THEN - X`009`009GOTO no_priv X$`009set default SYS$SYSTEM X$`009define/user_mode sys$output sys$scratch:disk_use.uaf X$`009define/user_mode sys$error _nl: X$`009run authorize XSHOW/FULL [*,*] XEXIT X$`009set default sys$scratch X$`009define/user_mode DSK 'disk' X$`009define/user_mode sys$output disk_use.txt X$`009run sys$system:diskquota XUSE DSK XSHOW [*,*] XEXIT X$`009quotatot = 0 X$`009open/write out disk_use.tmp X$`009open/read in disk_use.txt X$ `009maxblock = f$getdvi(disk,"MAXBLOCK") X$`009freeblocks = f$getdvi(disk,"FREEBLOCKS") X$`009read in rec X$ loop: X$`009`009read/end=done in rec X$`009`009uic = f$extract(0,f$locate(" ",rec),rec) X$`009`009IF f$length(uic) .eq. 0 THEN GOTO loop X$`009`009IF f$extract(0,1,uic) .eqs. "%" THEN GOTO loop X$`009`009IF f$cvsi(0,8,f$extract(f$length(uic)-1,1,uic)) .ne. 10 THEN - X`009`009`009GOTO notsplit X$`009`009uic = f$extract(0,f$length(uic)-2,uic) X$`009`009rec = f$extract(f$locate(" ",rec),f$length(rec),rec) X$ notsplit: X$ `009`009used = f$integer(f$edit(f$extract(18,13,rec),"TRIM")) X$`009`009quota = f$integer(f$edit(f$extract(31,16,rec),"TRIM")) X$`009`009IF used .eq. 0 THEN GOTO loop X$`009`009IF f$locate("[",uic) .eq. f$length(uic) THEN GOTO identifier X$`009`009define/user_mode sys$error _nl: X$`009`009define/user_mode sys$output _nl: X$`009`009search disk_use.uaf "''uic'"/window=(1,0)/output=disk_use.uic X$`009`009open/read inin disk_use.uic X$`009`009read/end=nouaf inin rec X$`009`009close inin X$`009`009delete disk_use.uic; X$`009`009ownerl = f$locate("Owner: ",rec) X$ `009`009username = f$edit(f$extract(10,ownerl-10,rec),"TRIM") X$`009`009owner = f$extract(ownerl+8,f$length(rec)-7-ownerl,rec) X$`009`009GOTO donesch X$ identifier: X$`009`009username = "" X$`009`009owner = "(Run AUTHORIZE to list owners)" X$`009`009GOTO donesch X$ nouaf: X$`009`009close inin X$`009`009delete disk_use.uic; X$`009`009username = "" X$ `009owner = "(No match in SYSUAF)" X$ donesch: X$`009`009upc = (1000 * used / maxblock + 5) / 10 X$`009`009qpc = (1000 * quota / maxblock + 5) / 10 X$`009`009quotatot = quotatot + quota X$ `009`009rec = f$fao("!12AS !32AS !8SL !11SL !6SL !6SL !AS",- X`009`009`009username,owner,used,quota,upc,qpc,uic) X$`009`009write out rec X$`009`009goto loop X$ done: X$`009close in X$`009close out X$`009delete disk_use.uaf; X$`009sort/key=(position:47,size:8,descending) disk_use.tmp disk_use.tmp X$`009open/write out disk_use.lis X$`009mynode = f$logical("SYS$NODE") - "_" - ":" - ":" X$ `009rec = - X`009f$fao("!30* DISK_USE PROCEDURE RUN ON NODE !AS ON !%D FOR DISK !AS",- X`009`009mynode, 0, disk) X$`009write out rec X$`009copy sys$input out X VUSERNAME PERSONAL NAME USED QUOTA USED XQUOTA UIC V (BLOCKS) (BLOCKS) (AS PERCEN XTAGES V OF DISK S XPACE) V-------------------------------------------------------------------------------- X----------------------------------------- X$`009usedpc = ((maxblock - freeblocks) * 1000 / maxblock + 5) / 10 X$`009quotapc = quotatot * 10 / ((maxblock + 5)/10) X$`009open/read in disk_use.tmp X$`009line = 6 X$ sloop: X$`009`009read/end=quit in rec X$`009`009write out rec X$`009`009line = line + 1 X$`009`009IF line .le. 64 THEN GOTO sloop X$`009`009write out f$fao("!^") X$`009`009copy sys$input out VUSERNAME PERSONAL NAME USED QUOTA USED XQUOTA UIC V (BLOCKS) (BLOCKS) (AS PERCEN XTAGES V OF DISK S XPACE) V-------------------------------------------------------------------------------- X----------------------------------------- X$`009 `009line = 4 X$`009`009GOTO sloop X$ quit: X$`009IF line .le. 60 THEN GOTO next X$`009write out f$fao("!^") X$ next: X$`009write out - V"------------------------------------------------------------------------------- X------------------------------------------" X$`009rec = - Xf$fao("TOTALS: (TOTAL DISK SPACE: !8SL) !8SL !11SL !6SL !6SL",- X`009`009maxblock,maxblock-freeblocks,quotatot,usedpc,quotapc) X$`009write out rec X$`009close out X$`009close in X$`009delete disk_use.txt; X$`009delete disk_use.tmp;* X$`009dummy = f$setprv(old_priv) X$`009IF verify_on THEN set verify X$`009EXIT X$ honk: X$`009write sys$output "You tried to run this command procedure in a batch" X$`009write sys$output "job without specifying a volume name, cretin." X$`009EXIT X$ error: X$`009write sys$output "Whoops - gotta exit. Trying to clean up." X$ interrupt: X$`009set noon X$`009IF f$logical("OUT") .nes. "" THEN close out X$`009IF f$logical("IN") .nes. "" THEN close in X$`009IF f$logical("ININ") .nes. "" THEN close inin X$`009set default sys$scratch X$`009IF f$search("DISK_USE.LIS") .nes. "" THEN delete disk_use.lis; X$`009IF f$search("DISK_USE.TMP") .nes. "" THEN delete disk_use.tmp;* X$`009IF f$search("DISK_USE.TXT") .nes. "" THEN delete disk_use.txt; X$`009IF f$search("DISK_USE.UAF") .nes. "" THEN delete disk_use.uaf; X$`009IF f$search("DISK_USE.UIC") .nes. "" THEN delete disk_use.uic; X$`009dummy = f$setprv(old_priv) X$`009EXIT X$ no_priv: X$`009write sys$output "You do not have the BYPASS and SYSPRV privileges" X$`009write sys$output "necessary to run this command procedure. Tough." $ GOSUB UNPACK_FILE $ EXIT