PARM what="?", level=0, entry=main # This script tries to provide meaningful information about the various # files, groups, accounts, directories, and database on this system. Read # the HELP text in the "do_help" routine for a general idea of what this # script does. Disc space usage is reported in KB only, KB and MB, or # MB only, depending on the size of the total. Currently, only leaf node # files count towards the disk usage total -- the space consumed by the # actual account, group, and directory entries is ignored. # Programmer note: disk space is internally accumulated in units of pages, with # 2^12=4096 bytes per page. This allows up to 8 TB to be counted for a single # group, account or directory via a signed 32 bit CI integer variable. # # There is an companion program, defined below by the _sw_db_pgm variable, # which, depending on its parm value, reads the Image "TC" file for DBE # names, or supplies Allbase DBE files for a specific DB-Con file. # # There are many combinations of output that can be reported, all controlled # by the "level" parm. The default level is to see basic system info; # however, greater details are provided by higher level values. The help # text, below, explains this. # # Errors, warnings, and progress are reported in a permanent file named # SIULOG. Each error/warning is displayed to $stdlist inline with the # grand total displayed at the end of the report, and in the error log file. # Each error/warning is numbered 1,2,...N in the order it is detected. # Since the file is permanent others can view it while this script is running # and taking so long! # # Note: POSIX directory names must begin with a "/", that is only absolute # pathnames are accepted. "@", "/" and " /@" are treated the same. # # Note: Directory names are only reported up to 4 levels deep. File space below # the 4th level is accumulated up to the 4th level. For example, if the file # "/a/b/c/d/e/file" is processed, its disk space accumulates to the 4th level # directory "d". # # Original authors: script : Jeff Vance, HP-CSY, Dec. 2001 # DB pgm : Tien-You Chen, HP-CSY, Dec. 2001 # # Version history at the end of this file. if "!entry" = "main" then # ** ** # ** main outer block entry ** # ** ** # make sure we are on a high enough rev of MPE/iX (6.0 PP1 or greater) if not bound(HPHHMMSSMMM) then echo echo The SIU tool requires the executing system to be on MPE/iX 6.0 PP1 echo or later. This system is on MPE/iX !hprelversion. Please contact HP & via echo Jazz at jazz.external.hp.com if assistance is required. SIU is not echo supported by the HP RC. echo escape endif # script version string setvar _sw_vers "B.06" echo echo H P 3 0 0 0 S y s t e m I n v e n t o r y U t i l i t y & vers !_sw_vers echo # some variables need to be set before help text is displayed, ie. the # names of certain files, level format names, etc. # name of this script, to save many references to HPFILE setvar _sw_me hpfile # name of the error log file, in the current working directory (CWD) setvar _sw_logf fqualify("SIULOG") # Name of the Known Vendor Accounts mapping file. This file maps MPE # account names to a vendor / company name. The account name can be # wildcarded, thus more specific entries should come before more generic # entries in this file. Absence of this file means that vendor info cannot # be gathered on this system. Default is in the current location of the # SIU script. if lft(_sw_me,1) = "/" then # HFS name for script -- why???, just use local CWD setvar _sw_me_ga "" else # MPE name for script setvar _sw_me_ga "." + xword(_sw_me,".") endif setvar _sw_kva_file "SIUVEND"+_sw_me_ga # Name of program that reads the Image "TC" file to map DBEs. This # privileged program reads the Image "TC" file until eof. The "TC" file # contains DBE names for Image/SQL databases. There can be more than one # DBE per Image/SQL database. Absence of this program means that specific # DBE names cannot be displayed. Default is in the current location of the # SIU script. setvar _sw_db_pgm "SIUDBP"+_sw_me_ga # Hard-coded format strings of equal field lengths, which must correlate # to the bit number in the in the numeric level mask. Each "field" in the # format string can be up to 9 chars long with one space as a delimiter. # 1 2 3 4 5 # 123456789012345678901234567890123456789012345678901 setvar _sw_fmts "SUMMARY ACCT DB VENDOR FILECODE & GROUP FILE IO " # Now we have defined enough of the environment to satisfy a help request if "!what" = "?" then xeq !_sw_me "!what" "!level" entry=do_help escape endif # set some vars for progress reporting and CPU/time statistics setvar _sw_start_cpu hpcpusecs setvar _sw_prev_cpu _sw_start_cpu setvar _sw_start_time lft(hphhmmssmmm,6) # create the permanent log file # Programmer note: this script only accesses the log file for a very short # duration while output is redirected to the file. The script is not able # to open the file once, keep it open, and close it before terminating. # Thus, another instance of this script could purge the logfile and re-build # it without any CI errors. if finfo(_sw_logf,'exists') then if finfo(_sw_logf,'accessors') > 0 then # logfile is being accessed, could be a transient write from this # script, or another process viewing it, etc. echo *** ERROR: Logfile "!_sw_logf" is being accessed, see below: listfile !_sw_logf,9 echo When there are no accessors re-run this script... escape endif if finfo(_sw_me,'accessors') > 1 then # Another instance of this script is executing. Remember the write # access to the logfile is very transient, and not likely detected # above. echo *** WARN: "!_sw_me" is already executing, see below: listfile !_sw_me,8 echo Your logfile "!_sw_logf" could be overwritten, depending on where echo the other instance(s) of this script are being executed. echo setvar _sw_rec "y" if hpinteractive then setvar _sw_rec dwns(lft(ltrim(input("...Continue script? ")),1)) echo endif if _sw_rec = "n" then escape endif endif # now purge the old logfile # let the script fail if the purge or build below fails... purge !_sw_logf endif # now build the permanent log/progress file build !_sw_logf;rec=-256,,v,ascii;disc=20000 # the log file writer has exclusive access, but others can read file !_sw_logf,old;ear # write the first entry to log file echo HP 3000 SIU (vers !_sw_vers) started on !hpdatef at !hptimef>*!_sw_logf echo Command parms: "!what" level="!level" >>*!_sw_logf setvar _sw_rec " Run by: #!hpjobtype!hpjobnum !hpjobname,!hpuser.!hpaccount" if hpspoolid <> "" then setvar _sw_rec _sw_rec+" SPID: !hpspoolid.OUT.HPSPOOL" endif echo !_sw_rec >>*!_sw_logf # initialize many counters and misc setvar _sw_save_mfence hpmsgfence setvar _sw_err_cnt 0 setvar _sw_warn_cnt 0 setvar _sw_kva_cnt 0 setvar _sw_tot_files 0 setvar _sw_tot_accts 0 setvar _sw_tot_grps 0 setvar _sw_tot_vs_grps 0 setvar _sw_tot_emp_grps 0 setvar _sw_tot_dirs 0 setvar _sw_tot_alldb 0 setvar _sw_tot_imgdb 0 setvar _sw_tot_jumbo 0 setvar _sw_tot_idx 0 setvar _sw_tot_imgTC 0 setvar _sw_acct_num_vs_grps 0 setvar _sw_acct_num_grps 0 setvar _sw_acct_num_dirs 0 setvar _sw_acct_big_file 0 setvar _sw_acct_big_grp 0 setvar _sw_acct_big_imgdb 0 setvar _sw_acct_emp_grps 0 setvar _sw_acct_g_most_files 0 setvar _sw_acct_num_imgdb 0 setvar _sw_acct_num_jumbo 0 setvar _sw_acct_num_idx 0 setvar _sw_acct_num_imgTC 0 setvar _sw_grp_num_dirs 0 setvar _sw_grp_num_imgdb 0 setvar _sw_sys_big_file 0 setvar _sw_sys_big_dir 0 setvar _sw_sys_big_grp 0 setvar _sw_sys_big_acct 0 setvar _sw_sys_big_imgdb 0 setvar _sw_sys_d_most_files 0 setvar _sw_sys_g_most_files 0 setvar _sw_sys_a_most_files 0 setvar _sw_sys_big_fname "" setvar _sw_sys_big_gname "" setvar _sw_sys_big_dname "" setvar _sw_sys_big_aname "" setvar _sw_sys_big_imgdb_name "" setvar _sw_acct_big_fname "" setvar _sw_acct_big_gname "" setvar _sw_acct_big_imgdb_name "" setvar _sw_sys_dname_most_files "" setvar _sw_sys_gname_most_files "" setvar _sw_sys_aname_most_files "" # These two vars contain the current and prior directory traversal depth setvar _sw_cur_depth 0 setvar _sw_prev_depth 0 # There are 3 four tiered arrays that keep track of: num_files, size(pages) # and directory type (acct, grp, dir) for a given account or root dir. # All levels deeper than 4 are collapsed to the 4th level. These arrays # are indexed by the _sw_arry_ndx and _sw_cur_depth vars. NOTE: the zeroth # elements for the num_files and size arrays is special in that it is not # cumulative. These 0 elements hold only the number of files and size of # these files directly under root (/). Elements 2..4 will accumulate up. # That is, elements 4 will be added to elements 3, and elements 3 will be # added to elements 2, etc. setvar _sw_num_files_0 0 setvar _sw_num_files_1 0 setvar _sw_num_files_2 0 setvar _sw_num_files_3 0 setvar _sw_num_files_4 0 setvar _sw_size_0 0 setvar _sw_size_1 0 setvar _sw_size_2 0 setvar _sw_size_3 0 setvar _sw_size_4 0 # The 3 directory type codes are: "A"=account, "G"=group, "D"=dir setvar _sw_dir_ty_1 "" setvar _sw_dir_ty_2 "" setvar _sw_dir_ty_3 "" setvar _sw_dir_ty_4 "" # are we in an account, a group, a directory? setvar _sw_in_acct false setvar _sw_in_grp false setvar _sw_in_dir false # delete the file code counter array deletevar _sw_fc_@ >$null # ** Programming Note: do NOT create any variables starting with '_sw_fc_' # ** unless they are filecode mnemonic variables. Variables staring with # ** this prefix are read for filecode formatting and deleted before the # ** script ends. # initialize the IMAGE root file info array # The format for this string array is: # byte 1 byte 2 byte 3 byte 4+ # ----------------------------------------------------------------- # | Jumbo-char | Indexed-char | DBE char | HFS DB pathname string # ----------------------------------------------------------------- # There is one array entry per Image database found on the system. # The number of elements is defined by _sw_IMGDB_0. setvar _sw_IMGDB_0 0 # ** Programming Note: there is a secondary array named _sw_IMGDBSZ that # ** holds the # of pages for each Image database on the system. The same # ** _sw_IMGDB_0 index value applies to this array too. # init a similar, but simplier, ALLBASE array setvar _sw_ALLDB_0 0 # deal with the "level" parm xeq !_sw_me "!what" "!level" entry=parse_level # returns _sw_int_lev, the bit-mask integer version of "level" # bits for various levels of detail. See help text above! setvar _sw_lev_acct odd(_sw_int_lev) setvar _sw_lev_db odd(_sw_int_lev lsr 1) setvar _sw_lev_vend odd(_sw_int_lev lsr 2) setvar _sw_lev_fc odd(_sw_int_lev lsr 3) setvar _sw_lev_group odd(_sw_int_lev lsr 4) setvar _sw_lev_file odd(_sw_int_lev lsr 5) setvar _sw_lev_io odd(_sw_int_lev lsr 6) # write the utility banner # echo ![rpt("-",34-len(hpsysname)/2-1)]!hpsysname& ![rpt("-",34-len(hpsysname)/2-1)] echo Detail Level is: ![decimal(_sw_int_lev)] (![octal(_sw_int_lev)], & ![hex(_sw_int_lev)]). Max level is 127 (%177, $7f) echo Displaying: system info, directory totals if _sw_lev_acct then echo Account summary info endif if _sw_lev_db then echo Database info endif if _sw_lev_vend then echo 3rd party vendor info endif if _sw_lev_fc then echo Special filecodes counts endif if _sw_lev_group then echo Group summary info endif if _sw_lev_file then echo Individual files shown based on file code or type endif if _sw_lev_io then echo I/O configuration info endif # load the Known Vendor Accounts file, if present, into a variable array. if _sw_lev_vend and finfo(_sw_kva_file,'exists') then xeq !_sw_me _sw_kva_ entry=read_kva >*!_sw_logf echo Account file "!_sw_kva_file" can't be found. >>*!_sw_logf setvar _sw_lev_vend false endif # verify the "TC" DBE mapping program file exists if _sw_lev_db and not setvar(_sw_dbpgm_ok,finfo(_sw_db_pgm,'exists')) then echo echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: & You requested database detailed info, but the program that echo provides some of this data ("!_sw_db_pgm") is missing. echo DBEs for Image/SQL and ALLBASE databases cannot be reported. echo # write to the error log file too echo *** WARN !_sw_warn_cnt: You requested database detailed info, but & the program that >>*!_sw_logf echo provides some of this data (!_sw_db_pgm) is missing. & >>*!_sw_logf endif ##################################################################### ## Start the reporting with 6 major steps here in the main entry ## ##################################################################### # 1. **** System Info **** xeq !_sw_me entry=sys_info # 2. **** I/O Info **** if _sw_lev_io then xeq !_sw_me entry=io_info endif # 3. **** Directory Info **** # Parse the "what" parm and collect all of the file info. # note: "directory info" needs to be collected to get file and filecode info xeq !_sw_me "!what" entry=dir_info # the above subroutine consumes by far the most time. # Report the summary results of processing the "what" parm. echo echo Directory Summary: echo - - - - - - - - - - echo # of accounts : !_sw_tot_accts if _sw_lev_vend then echo # of Vendor Accts : !_sw_kva_cnt endif if _sw_tot_emp_grps > 0 then echo # of groups : !_sw_tot_grps (!_sw_tot_emp_grps empty) else echo # of groups : !_sw_tot_grps endif echo # of grps user vols: !_sw_tot_vs_grps echo # of directories : !_sw_tot_dirs echo # of files : !_sw_tot_files if _sw_num_files_0 > 0 then setvar _sw_rec " # of files under / : !_sw_num_files_0 (" if _sw_size_0 > $800000 then setvar _sw_rec _sw_rec+"![_sw_size_0/256] MB)" elseif _sw_size_0 < $800 then setvar _sw_rec _sw_rec+"![_sw_size_0*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_size_0*4] KB, ![_sw_size_0/256] MB)" endif echo !_sw_rec endif echo # of Image DBs : !_sw_tot_imgdb if _sw_lev_db and _sw_tot_imgdb > 0 then echo # of DBs -!> DBEs : !_sw_tot_imgTC echo # of jumbo DBs : !_sw_tot_jumbo echo # of indexed DBs : !_sw_tot_idx setvar _sw_rec " Largest Image DB : !_sw_sys_big_imgdb_name (" if _sw_sys_big_imgdb > $800000 then setvar _sw_rec _sw_rec+"![_sw_sys_big_imgdb/256] MB)" elseif _sw_sys_big_imgdb < $800 then setvar _sw_rec _sw_rec+"![_sw_sys_big_imgdb*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_sys_big_imgdb*4] KB, & ![_sw_sys_big_imgdb/256] MB)" endif echo !_sw_rec endif if _sw_tot_alldb > 0 then echo # of Allbase DBEs : !_sw_tot_alldb endif setvar _sw_rec " Largest account : !_sw_sys_big_aname (" if _sw_sys_big_acct > $800000 then setvar _sw_rec _sw_rec+"![_sw_sys_big_acct/256] MB)" elseif _sw_sys_big_acct < $800 then setvar _sw_rec _sw_rec+"![_sw_sys_big_acct*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_sys_big_acct*4] KB, & ![_sw_sys_big_acct/256] MB)" endif echo !_sw_rec setvar _sw_rec " Largest group : !_sw_sys_big_gname (" if _sw_sys_big_grp > $800000 then setvar _sw_rec _sw_rec+"![_sw_sys_big_grp/1024] MB)" elseif _sw_sys_big_grp < $800 then setvar _sw_rec _sw_rec+"![_sw_sys_big_grp*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_sys_big_grp*4] KB, & ![_sw_sys_big_grp/256] MB)" endif echo !_sw_rec if _sw_tot_dirs > 0 then setvar _sw_rec " Largest directory : !_sw_sys_big_dname (" if _sw_sys_big_dir > $800000 then setvar _sw_rec _sw_rec+"![_sw_sys_big_dir/256] MB)" elseif _sw_sys_big_dir < $800 then setvar _sw_rec _sw_rec+"![_sw_sys_big_dir*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_sys_big_dir*4] KB, & ![_sw_sys_big_dir/256] MB)" endif echo !_sw_rec endif setvar _sw_rec " Largest file : !_sw_sys_big_fname (" if _sw_sys_big_file > $800000 then setvar _sw_rec _sw_rec+"![_sw_sys_big_file/256] MB)" elseif _sw_sys_big_file < $800 then setvar _sw_rec _sw_rec+"![_sw_sys_big_file*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_sys_big_file*4] KB, & ![_sw_sys_big_file/256] MB)" endif echo !_sw_rec echo Account most files : !_sw_sys_aname_most_files (!_sw_sys_a_most_files) echo Group most files : !_sw_sys_gname_most_files (!_sw_sys_g_most_files) if _sw_tot_dirs > 0 then echo Dir most files : !_sw_sys_dname_most_files & (!_sw_sys_d_most_files) endif # 4. **** Database Info **** if _sw_lev_db then echo echo echo ----------------------- Database Summary ----------------------- echo xeq !_sw_me entry=db_info endif # 5. **** Files by Filecode Info **** if _sw_lev_fc then xeq !_sw_me entry=fc_info endif # 6. **** 3rd Party Info **** if _sw_lev_vend then echo echo ------------------------- 3rd Party Info ------------------------ echo setvar _sw_i 0 while setvar(_sw_i,_sw_i+1) <= _sw_kva_0 do if lft(_sw_kva_!_sw_i,1) = 'x' then echo ![xword(_sw_kva_!_sw_i,'=')] installed in account: & ![word(_sw_kva_!_sw_i,'/',2)] endif endwhile endif ###### done! ###### echo echo ****************************************************************** echo # compute elapsed time setvar _sw_end_time lft(hphhmmssmmm,6) setvar _sw_tot_hrs ![lft(_sw_end_time,2)]-![lft(_sw_start_time,2)] setvar _sw_tot_mins ![str(_sw_end_time,3,2)]-![str(_sw_start_time,3,2)] setvar _sw_tot_secs ![rht(_sw_end_time,2)]-![rht(_sw_start_time,2)] if _sw_tot_secs < 0 then setvar _sw_tot_secs 60+_sw_tot_secs setvar _sw_tot_mins _sw_tot_mins-1 endif if _sw_tot_mins < 0 then setvar _sw_tot_mins 60+_sw_tot_mins setvar _sw_tot_hrs _sw_tot_hrs-1 endif if _sw_tot_hrs < 0 then setvar _sw_tot_hrs 24+_sw_tot_hrs endif # leading zero if needed setvar _sw_tot_hrs rpt('0',2-len("!_sw_tot_hrs"))+"!_sw_tot_hrs" setvar _sw_tot_mins rpt('0',2-len("!_sw_tot_mins"))+"!_sw_tot_mins" setvar _sw_tot_secs rpt('0',2-len("!_sw_tot_secs"))+"!_sw_tot_secs" echo Ended on !hpdatef, !hptimef Elapsed time: !_sw_tot_hrs:& !_sw_tot_mins:!_sw_tot_secs (![hpcpusecs-_sw_start_cpu] cpu secs) # write elapsed time to error log file too echo Ended on !hpdatef, !hptimef Elapsed time: !_sw_tot_hrs:!_sw_tot_mins& :!_sw_tot_secs (![hpcpusecs-_sw_start_cpu] cpu secs) >>*!_sw_logf # report total number of errors and warnings, even if 0. echo *** !_sw_err_cnt ERRORs, *** !_sw_warn_cnt WARNINGs >>*!_sw_logf if _sw_err_cnt <> 1 then echo *** !_sw_err_cnt errors reported *** else echo *** !_sw_err_cnt error reported *** endif if _sw_warn_cnt <> 1 then echo *** !_sw_warn_cnt warnings reported *** else echo *** !_sw_warn_cnt warning reported *** endif if _sw_err_cnt+_sw_warn_cnt > 0 then echo *** All error/warnings logged to: !_sw_logf endif echo #deletevar _sw_@ return ##### end of main outer block ##### # ***** All alternate entry points are below ***** # ***** in alphabetic order ***** # **** ALLBASE_SIZE **** # elseif '!entry' = 'allbase_size' then # Calculates the size in pages for the ALLBASE database. # # Input has been redirected to output of the DB pgm that produces listf,6 # like output when run with parm=2. Input file may be empty or blank. # # Parm1 = the fully qualified Allbase DB-con file name (MPE syntax) # Parm2 = CI variable name to hold cumulated page count # setvar _sw_tmp 0 setvar _sw_eof2 finfo(hpstdin,'eof') while setvar(_sw_eof2,_sw_eof2-1) >= 0 do # read db pgm output and get the # sectors if setvar(_sw_rec,ltrim(rtrim(input()))) <> "" and & finfo(_sw_rec,"exists") then # use caution with FINFO 'sectors' since it fails on a large file and # for other reasons- would be nice if finfo accepted a status parm... setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_sec finfo(_sw_rec,'sectors') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_rec,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: Sectors & error for file "!_sw_rec". File size not counted. echo *** WARN !_sw_warn_cnt: Sectors error for file & "!_sw_rec" >>*!_sw_logf setvar _sw_sec 0 elseif hpcierr <> 0 then # file disappeared setvar _sw_sec 0 endif # convert sectors to pages (always divides evenly) setvar _sw_tmp _sw_tmp + (_sw_sec/16) endif endwhile # return pages via parm2 setvar !level _sw_tmp return # **** DB_INFO **** # elseif '!entry' = 'db_info' then # Report the database summary for the system. This, in part, may include # running a program that reads the Image "TC" file which contains DBE names # for a given Image/SQL database. The two array vars used below are filled # in the "FILE" section of the "LIST_FILES" routine. The format for the # IMAGE arrays are: # -- IMGDB array -- # byte 1 : char, "Y" if Jumbo else "N" # byte 2 : char, "Y" if Indexed else "N" # byte 3 : char, "Y" if DBE else "N" # bytes 4+ : string, absolute database name in HFS format # -- IMGDBSZ array -- # bytes 1-4: integer, size in pages for entire database # # Allbase info is also displayed via a similar array, but page usage is # calculated here. # # Allbase array: # -- ALLDB array -- # bytes 1+ : string, absolute database name in HFS format # if _sw_tot_imgdb = 0 then echo No Image databases were found else echo Image Root File KB size (MB*) Jumbo Idx DBE echo -------------------------- ------------- ----- --- --- # process the IMGDB and IMGDBSZ arrays and display above info setvar _sw_i 0 while setvar(_sw_i,_sw_i+1) <= _sw_IMGDB_0 setvar _sw_rec _sw_IMGDB_!_sw_i setvar _sw_db_jumbo str(_sw_rec,1,1) setvar _sw_db_idx str(_sw_rec,2,1) setvar _sw_db_dbe str(_sw_rec,3,1) # convert HFS root file name to MPE setvar _sw_db rht(_sw_rec,-4) setvar _sw_db word(_sw_rec,"/",-1)+"."+word(_sw_rec,"/",-2)+"."+ & word(_sw_rec,"/",-3) # convert size from pages to KB or MB, as ascii, not an integer if _sw_IMGDBSZ_!_sw_i > $10000000 then # pretty big, so convert to MB - '*' flags MB setvar _sw_sz "![_sw_IMGDBSZ_!_sw_i/256]*" else setvar _sw_sz "![_sw_IMGDBSZ_!_sw_i*4] " endif echo !_sw_db ![rpt(" ",26-len("!_sw_db"))] & ![rpt(" ",12-len(_sw_sz))]!_sw_sz & !_sw_db_jumbo !_sw_db_idx !_sw_db_dbe if _sw_db_dbe = "Y" and _sw_dbpgm_ok then # run "TC" file mapping pgm(parm=1) to extract the DBE info # append "TC" to the absolute root file pathname setvar _sw_db rht(_sw_rec,-4) + "TC" xeq !_sw_db_pgm !_sw_db,1 echo endif endwhile endif if _sw_tot_alldb = 0 then echo echo No Allbase databases were found else echo echo Allbase DB-Con File KB size (MB*) echo -------------------------- ------------- # process the ALLDB and ALLDBSZ arrays and display above info setvar _sw_i 0 while setvar(_sw_i,_sw_i+1) <= _sw_ALLDB_0 setvar _sw_db _sw_ALLDB_!_sw_i # convert HFS root file name to MPE setvar _sw_db word(_sw_db,"/",-1)+"."+word(_sw_db,"/",-2)+"."+ & word(_sw_db,"/",-3) # calculate pages disk space for this Allbase database # first, run db pgm(parm=2) to get list of Allbase DBE files xeq !_sw_db_pgm !_sw_db,2 >swdbef # next, accumulate pages for each DBE file xeq !_sw_me !_sw_db _sw_sz entry=allbase_size $10000000 then # pretty big, so convert to MB - '*' flags MB setvar _sw_sz "![_sw_sz/256]*" else setvar _sw_sz "![_sw_sz*4] " endif echo !_sw_db ![rpt(" ",26-len("!_sw_db"))] & ![rpt(" ",12-len(_sw_sz))]!_sw_sz endwhile endif return # **** DIR_INFO **** # elseif "!entry" = 'dir_info' then # Main entry for collecting and driving all directory based reporting. # After parsing the "what" parm, use a two layer approach for listing all # lower level files, groups, dirs, etc. First, :lisfile,6 just the # highest level ("what") to a file. This handles wildcards so that the # temp/scratch files used are large enough. The second level reads the # output from the first listfile and performs another :listfile,6;tree in # HFS format for each record. # # Parse the "what" parm echo echo -------------------------- Directory Info -------------------------- setvar _sw_dirx 0 while setvar(_sw_dir,word("!what",' ,',setvar(_sw_dirx,_sw_dirx+1)))<> "" do # convert POSIX wildcard '*' to MPE '@' setvar _sw_dir repl(rtrim(_sw_dir),"*","@") if delimpos(_sw_dir,"/.") <> 1 then # convert MPE name to POSIX if pos(".",_sw_dir) = 0 then # convert "acct" to "/ACCT" setvar _sw_dir "/" + ups(_sw_dir) elseif wordcnt(_sw_dir,".") >= 2 then echo An account or /dir name must be specified. You used "!_sw_dir". echo An account or /dir name must be specified. >>*!_sw_logf if wordcnt(_sw_dir,".") > 2 then echo A qualified filename is not supported. else echo A "group.account" name is not supported. endif escape endif # else, a POSIX syntax name elseif_sw_dir = "/" then setvar _sw_dir "/@" else if lft(_sw_dir,1) = "." then echo A relative pathname is not supported. You used "!_sw_dir". echo A relative pathname is not supported. You used "!_sw_dir" & >>*!_sw_logf echo Use the MPE account name or "/directory-name". escape else # name start with "/" if wordcnt(_sw_dir,"/") > 2 then echo Absolute pathnames may only contain a single component. echo Absolute pathnames may only contain a single component.& >>*!_sw_logf echo Reduce the name to simply "![xword(_sw_dir,"/",-1)]" escape endif endif if rht(_sw_dir,1) = "/" then setvar _sw_dir lft(_sw_dir,len(_sw_dir)-1) endif endif setvar hpcierr 0 # list just this dir (could be wildcarded) to a scratch file continue listfile !_sw_dir,6 ;notree >swinvlf0 if hpcierr <> 0 then if hpcierr = 929 then echo The account, group or directory "!_sw_dir" does not exist. else print swinvlf0 endif echo Processing stopped... echo escape endif # the bulk of the work is done by the "read_level0" routine continue xeq !_sw_me !_sw_dir entry=read_level0 "" do echo !_sw_rec endwhile echo echo Combinations of the above level names are supported, & e.g., echo "VENDOR FILECODE DB ACCT", which corresponds to a & numeric level echo value of: #15 (%17). echo echo Note: not all individual files are displayed when the FILE & level is echo selected. Only files with filecodes or file types deemed & significant echo by this tool are listed. echo echo Integer bit-mask values: echo ----------------------- echo bit 31 = show account summary info echo bit 30 = show database info echo bit 29 = show 3rd party account(s) info echo bit 28 = show special filecode counts echo bit 27 = show group/directory info echo bit 26 = show individual files that matter (note that echo many file are not displayed, e.g. standard files echo bit 25 = show I/O config info echo echo For example, a "level" value of 11 (%13) asks that, in & addition echo to the default summary report, the following additional & information echo be shown: echo individual account info + echo database info + echo special filecode files echo An easy way to see everything is to use a level of -1. echo return # **** FC_INFO **** # elseif '!entry' = 'fc_info' then # Report filecode summary. All unique filecodes on this system are # kept track of and the number of files of each filecode are counted. # The filecodes are kept in a string variable array with the prefix: # '_sw_fc_'. Negative (PRIV) filecodes are similarly # stored as '_sw_fc_PRIV'. There is no variable that tracks # the array size, thus a :showvar _sw_fc_@ is done to obtain the full list # of filecode mnemonics. After processing the output of each showvar, the # same set of filecode variables are deleted. The processing order is # important: PRIV filecodes are done first, followed by all remaining # alphanumeric filecode mnemonics, followed last by numeric filecodes. # # Note: due to this handling of filecodes no script variables should # begin with "_sw_fc_", except for those variable tracking specific file # code counts. # echo echo echo ---------------- Files by Filecode Info ------------------------ # first, process file counts for all priv files setvar hpcierr 0 showvar _sw_fc_PRIV@ >swfcvars if hpcierr = 0 then xeq !_sw_me entry=file_info_privFC swfcvars if hpcierr = 0 then xeq !_sw_me entry=file_info_fmtFC swfcvars if hpcierr = 0 then xeq !_sw_me entry=file_info_otherFC = 0 do setvar _sw_rec input() setvar _sw_fcstr rht(word(_sw_rec),-8) setvar _sw_fc_tot _sw_fc_tot+![setvar(_sw_fccnt,word(_sw_rec,,-1))] echo # of !_sw_fcstr![rpt(' ',6-len(_sw_fcstr))]: !_sw_fccnt endwhile echo Total: !_sw_fc_tot return # **** FILE_INFO_OTHERFC **** # elseif '!entry' = 'file_info_otherFC' then # This routine reports all numeric filecode mnemonics found on the system. # Input has been redirected to the output of :showvar _sw_fc_@ *after* all # PRIV files *and* alphanumeric filecodes have been processed and deleted. # echo echo Other filecode files: echo setvar _sw_fc_tot 0 setvar _sw_eof0 finfo(hpstdin,'eof') while setvar(_sw_eof0,_sw_eof0-1) >= 0 do setvar _sw_rec input() setvar _sw_fcstr rht(word(_sw_rec),-8) setvar _sw_fc_tot _sw_fc_tot+![setvar(_sw_fccnt,word(_sw_rec,,-1))] echo # of !_sw_fcstr![rpt(' ',6-len(_sw_fcstr))]: !_sw_fccnt endwhile echo Total: !_sw_fc_tot return # **** FILE_INFO_PRIVFC **** # elseif '!entry' = 'file_info_privFC' then # This routine reports all PRIV filecode mnemonics found on the system. # Input has been redirected to the output of :showvar _sw_fc_PRIV@. # PRIV file codes are processed first, before numeric and alphanumeric # filecode mnemonics. # echo echo PRIV filecode files: echo # skip first record, which is _sw_fc_PRIV, which is the total number of # priv filecode files. input _sw_rec setvar _sw_eof0 finfo(hpstdin,'eof')-1 while setvar(_sw_eof0,_sw_eof0-1) >= 0 do setvar _sw_rec input() setvar _sw_fcstr "-"+rht(word(_sw_rec),-12) setvar _sw_fccnt word(_sw_rec,,-1) echo # of !_sw_fcstr![rpt(' ',6-len(_sw_fcstr))]: !_sw_fccnt endwhile echo Total: !_sw_fc_priv return # **** IMAGE_SIZE **** # elseif '!entry' = 'image_size' then # Calculates the size in pages for the IMAGE database. The caller issued the # listfile to display all files for this database, including jumbo control # files, jumbo chunk files, partial b-tree index files, Omnidex TPI files, # etc. However, it is still possible to construct a DB name such that the # caller's listfile will match more files than belong to the root DB being # counted. Thus, this routine needs to check the file code to ensure that # we only have Image files (and not another DB's root file). # # Input has been redirected to output of a listfile /ACCT/GRP/ROOT??|??.@,6 # # Parm1 = the absolute pathname of the root file (HFS syntax) # Parm2 = CI variable name to hold cumulated page count # Returns: parm2, plus: # _sw_db_dbe Y="TC" file exists, which maps to DBE # _sw_db_jumbo Y=one or more jumbo datasets # _sw_db_idx Y=one or more sets use b-tree partial keys # setvar _sw_db_dbe "N" setvar _sw_db_jumbo "N" setvar _sw_db_idx "N" setvar _sw_sec 0 setvar _sw_tmp 0 # check if the caller's listfile had some error. If so skip the root file, # but return something reasonable... if hpcierr = -9043 then # Cannot find expected datasets for root file # See if the set is unexpectedly missing or has not been created, by # reading the first user label in the root file and examining the ASCII # RL'CONDITION code in the 1st two bytes. if finfo("!what",'exists') and & finfo("!what",'user labels written') > 0 and & lft(finfo("!what",'first user label'),2) = "JB" then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: & Datasets not created for "!what"... skipped # write to the log file too echo *** WARN !_sw_warn_cnt: & Datasets not created for "!what"... skipped >>*!_sw_logf else echo *** ERROR ![setvar(_sw_err_cnt,_sw_err_cnt+1)]: & Datasets missing for "!what"... skipped echo *** ERROR !_sw_err_cnt: & Datasets missing for "!what"... skipped >>*!_sw_logf endif echo elseif hpcierr <> 0 then echo *** ERROR ![setvar(_sw_err_cnt,_sw_err_cnt+1)]: & Cannot access datasets for "!what" (CIERR !hpcierr)... skipped echo *** ERROR !_sw_err_cnt: & Cannot access datasets for "!what" (CIERR !hpcierr)... skipped & >>*!_sw_logf echo else setvar _sw_eof2 finfo(hpstdin,'eof') while setvar(_sw_eof2,_sw_eof2-1) >= 0 do # read listfile output and get the filecode if setvar(_sw_db_fc,finfo(setvar(_sw_rec,ltrim(rtrim(input()))), & 'fcode')) <= -401 and _sw_db_fc >= -490 then # an expected Image file and not a root file for another DB # use caution with FINFO 'sectors' since it fails on a large file setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_sec finfo(_sw_rec,'sectors') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_rec,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: Sectors & error for file "!_sw_rec". File size not counted. echo *** WARN !_sw_warn_cnt: Sectors error for file & "!_sw_rec" >>*!_sw_logf setvar _sw_sec 0 setvar hpcierr 0 elseif hpcierr <> 0 then # file disappeared setvar _sw_sec 0 endif # convert to pages and accumulate setvar _sw_tmp _sw_tmp + (_sw_sec/16) # check for jumbo control file if hpcierr = 0 then if setvar(_sw_db_fc,finfo(_sw_rec,'fcode')) = -408 then setvar _sw_db_jumbo "Y" # check for partial key index file elseif _sw_db_fc = -412 then setvar _sw_db_idx "Y" # check for "TC" file with DBE info elseif rht(_sw_rec,2) = "TC" and _sw_db_fc = -430 then setvar _sw_db_dbe "Y" endif endif endif endwhile endif # return pages via parm2 setvar !level _sw_tmp return # **** IO_INFO **** # elseif '!entry' = 'io_info' then # if sysinfo.prvxl.telesup was run in the sysinfo step, get io info there, # else do a simple SHOWDEV command. # if finfo('sysinfoz','exists') then # sysinfo.prvxl.telesup was run with the IO command print sysinfoz;start=18;end=-2;page=0 else echo echo ------------------------- IO Configuration ------------------------- echo showdev endif return # **** LIST_FILES **** # elseif "!entry" = 'list_files' then # Process each record from the :listfile,6;tree [in HFS format] executed # in the "read_level0" routine. This "list_files" routine performs the # bulk of individual account, group, directory and file processing, # including handling database files. All filecodes are processed here. # setvar _sw_eof1 finfo(hpstdin,'eof') if not (_sw_lev_file or _sw_lev_group) then # let the user know if we are processing a lot of files if _sw_eof1 > 5000 then echo if setvar(_sw_tmp,hpcpumsecs mod 5) = 0 then echo ... processing !_sw_eof1 files, so hang loose... elseif _sw_tmp = 1 then echo ... processing !_sw_eof1 files, so get some coffee... elseif _sw_tmp = 2 then echo ... processing !_sw_eof1 files, so relax... elseif _sw_tmp = 3 then echo ... processing !_sw_eof1 files, so take five... else echo ... processing !_sw_eof1 files, so chill... endif if _sw_eof1 > 50000 then if setvar(_sw_tmp,hpcpumsecs mod 3) = 0 then echo ... why do you have that many files in one spot? elseif _sw_tmp = 1 then echo ... you have time to jog around the block (twice!) else echo ... preparing next year's taxes might be faster! endif endif endif endif while setvar(_sw_eof1,_sw_eof1-1) >= 0 do setvar _sw_f ltrim(rtrim(input())) setvar _sw_cur_depth wordcnt(_sw_f,'/')-1 # Check for exiting an account, group, or directory. Extra test # to handle the previous level being empty. if (_sw_cur_depth < _sw_prev_depth) or & (_sw_cur_depth = _sw_prev_depth and & (_sw_rty="GROUP" or _sw_rty="DIRECTORY" or _sw_rty="ACCOUNT")) then # done with a dir, group or acct-- report subtotals and clear counters xeq !_sw_me entry=subtotals endif setvar _sw_prev_depth _sw_cur_depth # cap the directory reporting depth at 4 levels deep setvar _sw_arry_ndx min(4,_sw_cur_depth) # use caution calling FINFO since the file could be gone by now, or # there can be other problems, like bad UFID, etc... setvar hpcierr 0 # use caution with FINFO since the file could be gone by now... setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_rty finfo(_sw_f,'rectype') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_f,'exists') then echo *** ERROR ![setvar(_sw_err_cnt,_sw_err_cnt+1)]: file & "!_sw_f" skipped getting 'rectype' # write to log file too echo *** ERROR !_sw_err_cnt: file "!_sw_f" skipped hpcierr getting & 'rectype' >>*!_sw_logf setvar _sw_rty "" elseif hpcierr <> 0 then # file gone, so just quietly skip it setvar _sw_rty "" endif # ***** ACCOUNT ***** if _sw_rty = "ACCOUNT" then setvar _sw_a word(_sw_f,"/",2) if _sw_lev_group then echo echo In account: !_sw_a endif setvar _sw_tot_accts _sw_tot_accts+1 setvar _sw_in_acct true # set level 1 dir type to "A" for account setvar _sw_dir_ty_1 "A" if _sw_lev_vend then # see if the acct is a Known Vendor Acct (KVA) setvar _sw_vend_a "" setvar _sw_i 0 while setvar(_sw_i,_sw_i+1) <= _sw_kva_0 and & not pmatch(word(_sw_kva_![_sw_i+1],'='),_sw_f) do endwhile if _sw_i <= _sw_kva_0 # match setvar _sw_vend_a xword(_sw_kva_!_sw_i,"=") if _sw_lev_group then echo contains !_sw_vend_a products endif setvar _sw_kva_cnt _sw_kva_cnt+1 # mark this vendor array element as matched setvar _sw_kva_!_sw_i "x"+_sw_kva_!_sw_i endif endif # ***** GROUP ***** elseif _sw_rty = "GROUP" then setvar _sw_tot_grps _sw_tot_grps+1 setvar _sw_acct_num_grps _sw_acct_num_grps+1 setvar _sw_g word(_sw_f,"/",3) setvar _sw_in_grp true # set level 2 dir type to "G" for group setvar _sw_dir_ty_2 "G" # get homed user volset info if setvar(_sw_uv,finfo(_sw_f,'volume set name')) <> & "MPEXL_SYSTEM_VOLUME_SET" then setvar _sw_acct_num_vs_grps _sw_acct_num_vs_grps+1 setvar _sw_tot_vs_grps _sw_tot_vs_grps+1 endif # ***** DIRECTORY ***** elseif _sw_rty = "DIRECTORY" then if _sw_cur_depth = 1 and _sw_lev_group then # entering a new 'root level' dir echo echo In directory: !_sw_f endif setvar _sw_tot_dirs _sw_tot_dirs+1 setvar _sw_in_dir true # set level n dir type to "D" for directory setvar _sw_dir_ty_!_sw_arry_ndx "D" setvar _sw_d _sw_f if _sw_in_acct then setvar _sw_acct_num_dirs _sw_acct_num_dirs+1 if _sw_in_grp then setvar _sw_grp_num_dirs _sw_grp_num_dirs+1 endif endif # ***** FILE ***** elseif _sw_rty <> "" then # We (hopefully still) have a file! # Programming Note: this section of the script used to be a separate # entry routine, but due to its high usage the overall performance of # the script decreased by a factor of 3! :-{ So, to alleviate this # situation I have inlined routine here again... # # Count the file size (sectors converted to pages), database info if # the file is an IMAGE or ALLBASE file, filecode info, etc. Also, # since this section is likely called the most frequently, progress # data is logged. Note: the file may have been purged since the # LISTFILE found it, and this is detected trying to get the sectors. # #echo File: !_sw_f setvar _sw_tot_files _sw_tot_files+1 # decrement depth(level) index since files accumulate to parent, but # don't do this when the curr level is beyond the "folding" level of 4. setvar _sw_arry_ndx min(4,_sw_cur_depth-1) # log basic progress approx every 200 CPU seconds if hpcpusecs - _sw_prev_cpu >= 200 then echo progress= cpu: ![hpcpusecs-_sw_start_cpu] sec, # files: & !_sw_tot_files, file: !_sw_f >>*!_sw_logf setvar _sw_prev_cpu hpcpusecs endif # use caution with FINFO 'sectors' since it will fail on large files setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_size finfo(_sw_f,'sectors') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_f,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: Sectors & error for file "!_sw_f". File size not counted. # write to error log too echo *** WARN !_sw_warn_cnt: Sectors error for file "!_sw_f" & >>*!_sw_logf setvar _sw_size 0 setvar hpcierr 0 elseif hpcierr <> 0 then # file disappeared, so skip it setvar _sw_tot_files _sw_tot_files - 1 endif if hpcierr = 0 then # get filecode and optionally file type via finfo setvar hpmsgfence 2 continue setvar _sw_fc finfo(_sw_f,'fcode') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_f,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: can't & get filecode for "!_sw_f", using 0. echo *** WARN !_sw_warn_cnt: can't get filecode for "!_sw_f", & using 0. >>*!_sw_logf setvar _sw_fc 0 setvar hpcierr 0 elseif hpcierr <> 0 then # file disappeared, so skip it setvar _sw_tot_files _sw_tot_files - 1 endif endif # accumulate to parent num files for this traversal depth setvar _sw_num_files_!_sw_arry_ndx _sw_num_files_!_sw_arry_ndx+1 # convert size to pages and accumulate to parent level # note: sectors is always a multiple of pages(16 sectors=1 page) setvar _sw_size _sw_size / 16 # accumulate to parent size for this traversal depth setvar _sw_size_!_sw_arry_ndx _sw_size_!_sw_arry_ndx + _sw_size # determine largest file on the system if _sw_size > _sw_sys_big_file then setvar _sw_sys_big_file _sw_size setvar _sw_sys_big_fname _sw_f endif # determine largest file in the account if _sw_size > _sw_acct_big_file then setvar _sw_acct_big_file _sw_size setvar _sw_acct_big_fname _sw_f endif # determine the file type using the filecode # handle IMAGE db (root filecode = -400) if _sw_fc = -400 then setvar _sw_tot_imgdb _sw_tot_imgdb+1 # (Assume IMAGE dbs are in an group.account setvar _sw_acct_num_imgdb _sw_acct_num_imgdb+1 setvar _sw_grp_num_imgdb _sw_grp_num_imgdb+1 # Compute page size for this IMAGE db including the root file, all # datasets (remember datasets higher than 99 use a letter followed # by digit suffix), jumbo control files, jumbo chunk files, partial # key index files, Bradmark TPI files, etc. Note: the goal using # the listfile command below is to have a high chance of listing # only the files belong to the root DB. However, if one DB is named # "F" and another is named "F12" then a listfile F?? will include # the root file "F12". Thus, the routine that processes this # listfile needs to check the file code so that "F12" (in this # example) is not counted. if _sw_lev_db then setvar hpcierr 0 continue listfile (!"_sw_f"??,!"_sw_f"??.@),6 >swlfdb xeq !_sw_me !_sw_f _sw_db_sz entry=image_size < swlfdb # returns _sw_db_sz, _sw_db_jumbo, _sw_db_idx, _sw_db_dbe # add root file pages to the DB total setvar _sw_db_sz _sw_db_sz+_sw_size # fill database "arrays" per this format: # -- IMGDB array -- # byte 1 : char, "Y" if Jumbo else "N" # byte 2 : char, "Y" if Indexed else "N" # byte 3 : char, "Y" if DBE else "N" # bytes 4+ : string, absolute database name in HFS format # -- IMGDBSZ array -- # bytes 1-4: integer, size in pages for entire database # if hpcierr = 0 then # no error from listfile above setvar _sw_IMGDB_0 _sw_IMGDB_0+1 setvar _sw_IMGDB_!_sw_IMGDB_0 & _sw_db_jumbo + _sw_db_idx + _sw_db_dbe + _sw_f setvar _sw_IMGDBSZ_!_sw_IMGDB_0 _sw_db_sz endif # count DBE "TC" files if _sw_db_dbe = "Y" then setvar _sw_tot_imgTC _sw_tot_imgTC+1 setvar _sw_acct_num_imgTC _sw_acct_num_imgTC+1 endif # count jumbo datasets if _sw_db_jumbo = "Y" then setvar _sw_tot_jumbo _sw_tot_jumbo+1 setvar _sw_acct_num_jumbo _sw_acct_num_jumbo+1 endif # count partial key (b-tree) indexing if _sw_db_idx = "Y" then setvar _sw_tot_idx _sw_tot_idx+1 setvar _sw_acct_num_idx _sw_acct_num_idx+1 endif # find largest Image DB in this account if _sw_db_sz > _sw_acct_big_imgdb then setvar _sw_acct_big_imgdb _sw_db_sz setvar _sw_acct_big_imgdb_name _sw_f endif # find largest Image DB on system if _sw_db_sz > _sw_sys_big_imgdb then setvar _sw_sys_big_imgdb _sw_db_sz setvar _sw_sys_big_imgdb_name _sw_f endif endif # handle ALLBASE DB-Con filecode = -491) elseif _sw_fc = -491 then setvar _sw_tot_alldb _sw_tot_alldb+1 if _sw_lev_db then setvar _sw_ALLDB_0 _sw_ALLDB_0+1 setvar _sw_ALLDB_!_sw_ALLDB_0 _sw_f endif endif if (_sw_lev_fc or _sw_lev_file) and hpcierr = 0 then # get the string filecode mnemonic too # use caution with finfo since the file could be deleted etc... setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_fcstr finfo(_sw_f,'fmtfcode') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_f,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: can't get & filecode for "!_sw_f", using "0". echo *** WARN !_sw_warn_cnt: can't get filecode for "!_sw_f", & using "0". >>*!_sw_logf setvar _sw_fcstr "0" elseif hpcierr <> 0 then # file disappeared setvar _sw_tot_files _sw_tot_files - 1 endif if _sw_fcstr = "" then setvar _sw_fcstr "0" endif # increment file code counter array element if _sw_lev_fc and hpcierr = 0 then if bound(_sw_fc_!_sw_fcstr) then setvar _sw_fc_!_sw_fcstr _sw_fc_!_sw_fcstr+1 else setvar _sw_fc_!_sw_fcstr 1 endif if _sw_fc < 0 then # PRIV code, all mnemonics are just "priv" setvar _sw_fc -_sw_fc if bound(_sw_fc_PRIV!_sw_fc) then setvar _sw_fc_PRIV!_sw_fc _sw_fc_PRIV!_sw_fc+1 else setvar _sw_fc_PRIV!_sw_fc 1 endif setvar _sw_fc -_sw_fc endif endif if _sw_lev_file and hpcierr = 0 then # echo individual file info to $stdlist setvar _sw_f_desc "" if _sw_fc < 0 then # negative (PRIV) filecodes if _sw_fc = -10 or _sw_fc = -20 or _sw_fc = -30 or & _sw_fc = -40 or _sw_fc = -50 or _sw_fc = -60 or & _sw_fc = -73 or _sw_fc = -100 or _sw_fc = -101 or & _sw_fc = -300 then setvar _sw_f_desc "HP Desk" elseif _sw_fc = -12 then setvar _sw_f_desc "Unison DiscMaster compressed" elseif _sw_fc = -200 then setvar _sw_f_desc "HPUID" #elseif _sw_fc = -201 then # setvar _sw_f_desc "HPUIDX" elseif _sw_fc = -202 then setvar _sw_f_desc "HPGID" #elseif _sw_fc = -203 then # setvar _sw_f_desc "HPGIDX" elseif _sw_fc = -296 then setvar _sw_f_desc "FYI Mail" elseif _sw_fc = -400 then setvar _sw_f_desc "IMAGE root" # don't bother echoing the IMAGE datasets... elseif _sw_fc = -402 then setvar _sw_f_desc "IMAGE remote DB" elseif _sw_fc = -404 then setvar _sw_f_desc "IMAGE ILR" elseif _sw_fc = -408 then setvar _sw_f_desc "IMAGE Jumbo Cntl" elseif _sw_fc = -410 or _sw_fc = -411 then setvar _sw_f_desc "IMAGE TPI" elseif _sw_fc = -430 then setvar _sw_f_desc "IMAGE DBE map" elseif _sw_fc <= -490 and _sw_fc >= -499 then setvar _sw_f_desc "ALLBASE" elseif _sw_fc = -516 then setvar _sw_f_desc "AIF" elseif _sw_fc = -601 then setvar _sw_f_desc "TEACHME" elseif _sw_fc = -893 then setvar _sw_f_desc "Oracle" elseif (_sw_fc <= -900 and _sw_fc >= -997) or & _sw_fc = -7652 or _sw_fc = -7653 or _sw_fc = -9876 then setvar _sw_f_desc "Orbit Backup+" elseif _sw_fc = -998 or _sw_fc = -999 then setvar _sw_f_desc "Orbit or RoadRunner" elseif _sw_fc = -1234 then setvar _sw_f_desc "MPE V MemLog" elseif _sw_fc = -16976 then setvar _sw_f_desc "BackPack virt tape" elseif _sw_fc = -21074 then setvar _sw_f_desc "RoadRunner virt tape" elseif _sw_fc <= -21000 and _sw_fc >= -21099 then setvar _sw_f_desc "Unison" endif elseif _sw_fc > 0 then # positive filecodes if (_sw_fc >= 8 and _sw_fc <= 19) or & _sw_fc = 65 then setvar _sw_f_desc "ADAGER" elseif _sw_fc = 72 then setvar _sw_f_desc "Uhaul" #elseif _sw_fc = 111 then # setvar _sw_f_desc "QEDIT" elseif _sw_fc >= 171 and _sw_fc <= 176 then setvar _sw_f_desc "VESoft" elseif _sw_fc = 230 then setvar _sw_f_desc "SpeedEdit" elseif _sw_fc >= 430 and _sw_fc <= 449 then setvar _sw_f_desc "DataExpress" elseif _sw_fc = 634 then setvar _sw_f_desc "HiBack save" # some Cognos filecodes follow ... elseif _sw_fc = 640 then setvar _sw_f_desc "QDD" elseif _sw_fc = 641 then setvar _sw_f_desc "Quick" elseif _sw_fc = 642 then setvar _sw_f_desc "Quiz" elseif _sw_fc = 643 then setvar _sw_f_desc "QTP compiled run" elseif _sw_fc = 644 then setvar _sw_f_desc "Cognos subfile" elseif _sw_fc = 647 then setvar _sw_f_desc "Cognos portable subfile mini-dict" elseif _sw_fc = 648 then setvar _sw_f_desc "Cognos portable subfile data" elseif _sw_fc = 649 then setvar _sw_f_desc "QTP mini-dict" elseif _sw_fc = 655 then setvar _sw_f_desc "PDL/PHD dictionary" # Cognos catch-all elseif _sw_fc >= 640 and _sw_fc <= 655 then setvar _sw_f_desc "Cognos" elseif _sw_fc = 665 then setvar _sw_f_desc "LZW" elseif _sw_fc = 707 then setvar _sw_f_desc "QUARK" elseif _sw_fc = 711 or _sw_fc = 712 or _sw_fc = 719 or & _sw_fc = 757 then setvar _sw_f_desc "Squisher" elseif _sw_fc = 777 then setvar _sw_f_desc "Compression Storage Mgr" elseif _sw_fc = 793 then setvar _sw_f_desc "SPLASH! error" elseif _sw_fc = 817 or _sw_fc = 993 then setvar _sw_f_desc "WordPerfect" elseif _sw_fc = 900 or & (_sw_fc >= 994 and _sw_fc <= 998) then setvar _sw_f_desc "WRQ" elseif _sw_fc = 1012 then setvar _sw_f_desc "OCS" elseif _sw_fc = 1020 then setvar _sw_f_desc "SLATE" elseif _sw_fc = 1023 then setvar _sw_f_desc "BackPack" elseif _sw_fc = 1024 then setvar _sw_f_desc "CM USL" elseif _sw_fc = 1025 then setvar _sw_f_desc "BASIC-V data" elseif _sw_fc = 1026 then setvar _sw_f_desc "BASIC-V prog" elseif _sw_fc = 1027 then setvar _sw_f_desc "BASIC-V fast prog" elseif _sw_fc = 1028 then setvar _sw_f_desc "CM RL" elseif _sw_fc = 1029 then setvar _sw_f_desc "CM prog" elseif _sw_fc = 1030 then setvar _sw_f_desc "NM prog" elseif _sw_fc = 1031 then setvar _sw_f_desc "CM SL" elseif _sw_fc = 1032 then setvar _sw_f_desc "NM XL" elseif _sw_fc = 1033 then setvar _sw_f_desc "NM RL" elseif _sw_fc = 1035 then setvar _sw_f_desc "VPLUS form" elseif _sw_fc = 1036 then setvar _sw_f_desc "VPLUS fast form" elseif _sw_fc = 1037 then setvar _sw_f_desc "VPLUS reformat" elseif _sw_fc = 1050 then setvar _sw_f_desc "Edit Quick" elseif _sw_fc = 1051 then setvar _sw_f_desc "Edit COBOL keep" elseif _sw_fc = 1052 then setvar _sw_f_desc "Edit COBOL text" elseif _sw_fc >= 1054 and _sw_fc <= 1059 then setvar _sw_f_desc "TDP" elseif _sw_fc >= 1070 and _sw_fc <= 1072 then setvar _sw_f_desc "QUERY" elseif _sw_fc = 1080 then setvar _sw_f_desc "KSAM Key" elseif _sw_fc = 1083 then setvar _sw_f_desc "GRAPH" elseif _sw_fc = 1084 then setvar _sw_f_desc "Self Desr" elseif _sw_fc = 1090 then setvar _sw_f_desc "User log" elseif _sw_fc >= 1100 and _sw_fc <= 1102 or & _sw_fc = 3333 then setvar _sw_f_desc "HP Word" elseif _sw_fc = 1103 then setvar _sw_f_desc "HP2601 Env" elseif _sw_fc >= 1110 and _sw_fc <= 1114 then setvar _sw_f_desc "IDS / IFS" elseif _sw_fc >= 1145 and _sw_fc <= 1149 then setvar _sw_f_desc "HP DRAW" elseif _sw_fc >= 1150 and _sw_fc <= 1153 then setvar _sw_f_desc "HP SLATE" elseif _sw_fc = 1156 then setvar _sw_f_desc "Dict Store" elseif _sw_fc = 1157 then setvar _sw_f_desc "Transact" elseif _sw_fc = 1158 then setvar _sw_f_desc "Report" elseif _sw_fc = 1159 then setvar _sw_f_desc "Inform" elseif _sw_fc = 1192 then setvar _sw_f_desc "N/W Conf" elseif _sw_fc = 1193 then setvar _sw_f_desc "N/W trace" elseif _sw_fc = 1194 then setvar _sw_f_desc "N/W log" elseif _sw_fc = 1242 then setvar _sw_f_desc "Basic data" elseif _sw_fc = 1243 then setvar _sw_f_desc "Basic form" elseif _sw_fc = 1244 then setvar _sw_f_desc "Basic save pgm" elseif _sw_fc = 1245 then setvar _sw_f_desc "Basic conf" elseif _sw_fc = 1247 then setvar _sw_f_desc "Bus-Basic/XL prog" elseif _sw_fc = 1248 then setvar _sw_f_desc "Bus-Basic/XL XL" elseif _sw_fc = 1249 then setvar _sw_f_desc "Bus-Basic/V bin" elseif _sw_fc = 1587 then setvar _sw_f_desc "HP Desk Postscript Writer" elseif (_sw_fc >= 1265 and _sw_fc <= 1269) or & (_sw_fc >= 1446 and _sw_fc <= 1455) or & (_sw_fc >= 1550 and _sw_fc <= 2349) or & _sw_fc = 99 or _sw_fc = 1277 or _sw_fc = 1521 or & _sw_fc = 2500 then setvar _sw_f_desc "HP Desk misc" elseif _sw_fc >= 1428 and _sw_fc <= 1438 then setvar _sw_f_desc "BRW" elseif _sw_fc = 1461 then setvar _sw_f_desc "NM Obj" elseif _sw_fc = 1462 then setvar _sw_f_desc "Pascal src lib" elseif _sw_fc = 1515 then setvar _sw_f_desc "Input spool" elseif _sw_fc = 1516 then setvar _sw_f_desc "Output spool" elseif _sw_fc = 1517 then setvar _sw_f_desc "Spool Checkpoint" elseif _sw_fc = 1607 then setvar _sw_f_desc "GIF" elseif _sw_fc = 1701 then setvar _sw_f_desc "Trek" elseif _sw_fc = 2133 then setvar _sw_f_desc "NetMail Text/HTML" elseif _sw_fc = 2501 then setvar _sw_f_desc "Store-to-disk" elseif _sw_fc = 5000 then setvar _sw_f_desc "DB General" elseif _sw_fc >= 5100 and _sw_fc <= 5199 then setvar _sw_f_desc "Allegro" elseif _sw_fc = 5220 then setvar _sw_f_desc "PGP" elseif _sw_fc >= 5300 and _sw_fc <= 5301 then setvar _sw_f_desc "Robelle huge" elseif _sw_fc >= 5400 and _sw_fc <= 5403 then setvar _sw_f_desc "QSS" elseif _sw_fc = 6000 then setvar _sw_f_desc "PROBE/iX log" elseif _sw_fc = 7210 or _sw_fc = 7350 or _sw_fc = 7604 or & (_sw_fc >= 7679 and _sw_fc <= 7684) or _sw_fc = 7690 then setvar _sw_f_desc "DISC Omnidex" elseif _sw_fc >= 8000 and _sw_fc <= 8099 then setvar _sw_f_desc "APL" elseif _sw_fc = 9876 then setvar _sw_f_desc "Orbit Backup+" elseif _sw_fc = 19787 then setvar _sw_f_desc "Easytime msgcat" elseif _sw_fc = 21074 then setvar _sw_f_desc "RoadRunner virt tape" endif else # filecode is ZERO, could be source, JCL, script, UDC, # KSAM/XL, KSAM64, CM KSAM, RIO, MSG, CIR, etc. For now # we are ignoring STD, SPOOL, and DIR file types. # use caution with finfo since the file could be deleted setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _sw_ftype finfo(_sw_f,'Intfiletype') setvar hpmsgfence _sw_save_mfence if hpcierr <> 0 and finfo(_sw_f,'exists') then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: & can't get filetype for "!_sw_f", file ignored. echo *** WARN !_sw_warn_cnt: can't get filetype for & "!_sw_f ", file ignored. >>*!_sw_logf setvar _sw_ftype 0 elseif hpcierr <> 0 then # file disappeared setvar _sw_tot_files _sw_tot_files - 1 setvar _sw_ftype 0 endif if _sw_ftype <> 0 and _sw_ftype <> 5 and _sw_ftype <> 9 then # skip 0=STD, 5=SPOOL, 9=DIR setvar _sw_f_desc finfo(_sw_f,'filetype') endif endif if _sw_f_desc <> "" then echo !_sw_f_desc file: & ![rpt(" ",max(0,10-len(_sw_f_desc)))] !_sw_f (!_sw_fc) endif endif endif endif endwhile # report final subtotals setvar _sw_cur_depth 1 # force an exit from all lower levels xeq !_sw_me !_sw_f entry=subtotals return # **** READ_KVA **** # elseif '!entry' = 'read_kva' then # Read the Known Vendor Accounts file, verified to exist. # Input redirected to this file. File format is: # Acct_Name Vendor Name (spaces ok) # ... # Wildcards are supported for the Acct_Name field, thus more specific # entries must precede generic/wildcarded entries. Records beginning with # a '#' are treated as a comment. # # The "what" parm is passed in as the base name of the variable array. Each # element is set to the string "/ACCT/=Vendor". The array is created # starting at element 1 and ends with element "eof". The zeroth # element contains the number of cells in the array. # # The array element format of "/ACCT/=vendor" is convenient for two purposes: # 1) it makes matching names from LISTFILE,6 easy, and 2) it leaves room # for a flag char in front of the leading '/' to indicate that this vendor's # account was found on the system. If no matching account is found the first # char remains '/'. If a matching vendor account is found an 'x' is # prepended, e.g. "x/ACCT/=Vendor" # # All array scanning must begin at element 1 and end at element N, where N # is defined by the value of element 0. # setvar _sw_i 0 setvar _sw_eof finfo(hpstdin,'eof') while setvar(_sw_eof,_sw_eof-1) >= 0 do setvar _sw_rec ltrim(rtrim(input())) if _sw_rec <> "" and lft(_sw_rec,1) <> "#" then setvar _sw_i _sw_i + 1 setvar !"what"!_sw_i "/" + ups(word(_sw_rec)) + "/" + "=" + & xword(_sw_rec) endif endwhile setvar !"what"0 _sw_i return # **** READ_LEVEL0 **** # elseif '!entry' = 'read_level0' then # Read first level groups, dirs and files from the output of a # listfile,6;notree. Script is split up like this to handle wildcarded # accounts without requiring really huge temp files. setvar _sw_eof0 finfo(hpstdin,'eof') while setvar(_sw_eof0,_sw_eof0-1) >= 0 do setvar _sw_d ltrim(rtrim(input())) # list all groups, dirs and files below this level and all # descendant files and dirs. Now, this may require a large file... purge swinvlf1;temp >$null file swinvlf1;disc=1651885 errclear continue listfile !_sw_d,6 ;tree >*swinvlf1 if hpcierr <> 0 then # ignore all errors and warnings -- file may have been deleted return endif continue xeq !_sw_me !_sw_d entry=list_files "" do if setvar(_sw_pos,pos(_sw_rec+" ",_sw_fmts)) > 0 then # ignore SUMMARY option since it is always reported and we # don't want lsl -1 below! if _sw_pos > 1 then # not the "summary" (default) option, some other name # set the appropriate level bit setvar _sw_int_lev _sw_int_lev bor (1 lsl ((_sw_pos / 10) - 1)) endif else echo ERROR ![setvar(_sw_err_cnt,_sw_err_cnt+1)]: & Unexpected format value "!_sw_rec". Done. echo ERROR !_sw_err_cnt: & Unexpected format value "!_sw_rec". Done.>>*!_sw_logf escape endif endwhile endif return # **** SUBTOTALS **** # elseif '!entry' = 'subtotals' then # This routine accumulates all of the sub totals. Also, for group and # account breaks, and depending of the format level, more detailed reporting # is performed. Sub total counter variables are reset here. The current # depth var (_sw_cur_depth) contains the depth of the object we will begin # processing after exiting from this subroutine. The previous depth var # (_sw_prev_depth) contains the dir depth of the object we are about to # complete processing here in this routine. The array index var # (_sw_arry_ndx) is always in the range of 1..4 and indexes the level # being processes, i.e. the previous level. # Assumptions: 1) current dir depth is <= previous dir depth. # see if any subtotal reporting and counter resetting is needed #echo c=!_sw_cur_depth/p=!_sw_prev_depth/ndx=!_sw_arry_ndx, _sw_f=!_sw_f #echo !>InDir=!_sw_in_dir, InGrp=!_sw_in_grp, InAcct=!_sw_in_acct #echo !>NF1=!_sw_num_files_1 NF2=!_sw_num_files_2 NF3=!_sw_num_files_3 & NF4=!_sw_num_files_4 S1= !_sw_size_1 S2= !_sw_size_2 S3= !_sw_size_3 & S4= !_sw_size_4 if _sw_cur_depth > 4 then # too deep in directory to report or reset anything return endif # accumulate deeper(previous) levels to current level, but not to level 0 # since level 0 only counts files directly under root (/) setvar _sw_i _sw_arry_ndx+1 while setvar(_sw_i,_sw_i-1) >= _sw_cur_depth and _sw_i > 1 do setvar _sw_num_files_![_sw_i-1] _sw_num_files_![_sw_i-1] + & _sw_num_files_!_sw_i setvar _sw_size_![_sw_i-1] _sw_size_![_sw_i-1] + _sw_size_!_sw_i endwhile # *** Exiting a directory? *** if _sw_in_dir then # find largest dir on the system if _sw_size_!_sw_arry_ndx > _sw_sys_big_dir then setvar _sw_sys_big_dir _sw_size_!_sw_arry_ndx setvar _sw_sys_big_dname lft(_sw_d,pos("/",_sw_d,_sw_arry_ndx+1)) endif # find the dir with the most files on the system if _sw_num_files_!_sw_arry_ndx > _sw_sys_d_most_files then setvar _sw_sys_d_most_files _sw_num_files_!_sw_arry_ndx setvar _sw_sys_dname_most_files lft(_sw_d,pos("/",_sw_d,& _sw_arry_ndx+1)) endif # report directory stats and reset "array" counters setvar _sw_i _sw_arry_ndx+1 while setvar(_sw_i,_sw_i-1) >= _sw_cur_depth and & _sw_dir_ty_![_sw_i-1] = "D" do if _sw_lev_group then if _sw_num_files_!_sw_i > 0 then # cut dir name down to the correct num of components, since the # dir we are finishing here might be more than 4 levels deep setvar _sw_d lft(_sw_d,pos("/",_sw_d,_sw_i+1)) setvar _sw_rec rpt(" ",7-len('!"_sw_num_files_!_sw_i"')) + & '!"_sw_num_files_!_sw_i" file' if _sw_num_files_!_sw_i = 1 then setvar _sw_rec _sw_rec+" " else setvar _sw_rec _sw_rec+"s " endif setvar _sw_rec _sw_rec + "in directory !_sw_d" if _sw_size_!_sw_i > $800000 then # use MB setvar _sw_size_!_sw_i _sw_size_!_sw_i / 256 setvar _sw_rec _sw_rec+rpt(" ",40-(len(_sw_d) + & len('!"_sw_size_!_sw_i"')))+' !"_sw_size_!_sw_i" MB' else # use KB setvar _sw_size_!_sw_i _sw_size_!_sw_i * 4 setvar _sw_rec _sw_rec+rpt(" ",40-(len(_sw_d) + & len('!"_sw_size_!_sw_i"')))+' !"_sw_size_!_sw_i" KB' endif echo !_sw_rec endif endif # clear the num files and size counters at this level setvar _sw_num_files_!_sw_i 0 setvar _sw_size_!_sw_i 0 endwhile # are we still in a directory? setvar _sw_in_dir (_sw_cur_depth > 1) and & (_sw_dir_ty_![_sw_cur_depth-1] = "D") endif # *** Exiting a group? *** if _sw_cur_depth <= 2 and _sw_in_grp then # find largest group in this acct and on the system if _sw_size_2 > _sw_acct_big_grp then setvar _sw_acct_big_grp _sw_size_2 setvar _sw_acct_big_gname "!_sw_g.!_sw_a" endif if _sw_size_2 > _sw_sys_big_grp then setvar _sw_sys_big_grp _sw_size_2 setvar _sw_sys_big_gname "!_sw_g.!_sw_a" endif # find the group with the most files in this acct if _sw_num_files_2 > _sw_acct_g_most_files then setvar _sw_acct_g_most_files _sw_num_files_2 setvar _sw_acct_gname_most_files "!_sw_g.!_sw_a" endif # find the group with the most files on the system if _sw_num_files_2 > _sw_sys_g_most_files then setvar _sw_sys_g_most_files _sw_num_files_2 setvar _sw_sys_gname_most_files "!_sw_g.!_sw_a" endif # accumulate num of empty groups if _sw_num_files_2 = 0 then setvar _sw_acct_emp_grps _sw_acct_emp_grps+1 setvar _sw_tot_emp_grps _sw_tot_emp_grps+1 endif # report some group details based on level if _sw_lev_group then if _sw_num_files_2 > 0 then setvar _sw_rec rpt(" ",7-len("!_sw_num_files_2")) + & "!_sw_num_files_2 file" if _sw_num_files_2 = 1 then setvar _sw_rec _sw_rec+" " else setvar _sw_rec _sw_rec+"s " endif setvar _sw_rec _sw_rec+"in group !_sw_g"+rpt(" ",9-len(_sw_g)) if _sw_size_2 > $800000 then # convert to MB setvar _sw_size_2 _sw_size_2 / 256 setvar _sw_rec _sw_rec+rpt(" ",9-len('!_sw_size_2')) + & "!_sw_size_2 MB" else # convert to KB setvar _sw_size_2 _sw_size_2 * 4 setvar _sw_rec _sw_rec+rpt(" ",9-len('!_sw_size_2')) + & "!_sw_size_2 KB" endif if _sw_uv <> "MPEXL_SYSTEM_VOLUME_SET" then setvar _sw_rec _sw_rec+" on !_sw_uv" endif echo !_sw_rec endif if _sw_lev_db and _sw_grp_num_imgdb > 0 then setvar _sw_rec " (includes & !_sw_grp_num_imgdb database" if _sw_grp_num_imgdb = 1 then setvar _sw_rec _sw_rec + ")" else setvar _sw_rec _sw_rec + "s)" endif echo !_sw_rec endif if _sw_grp_num_dirs > 0 then setvar _sw_rec rpt(" ",7-len("!_sw_grp_num_dirs")) + & "!_sw_grp_num_dirs" if _sw_grp_num_dirs = 1 then setvar _sw_rec _sw_rec+" directory " else setvar _sw_rec _sw_rec+" directories" endif setvar _sw_rec _sw_rec+" in group !_sw_g" echo !_sw_rec endif endif # reset group counters setvar _sw_num_files_2 0 setvar _sw_num_files_3 0 setvar _sw_num_files_4 0 setvar _sw_size_2 0 setvar _sw_size_3 0 setvar _sw_size_4 0 setvar _sw_grp_num_dirs 0 setvar _sw_grp_num_imgdb 0 setvar _sw_in_grp false endif # *** Exiting an account? *** if _sw_cur_depth = 1 and _sw_in_acct then # find the largest acct on the system if _sw_size_1 > _sw_sys_big_acct then setvar _sw_sys_big_acct _sw_size_1 setvar _sw_sys_big_aname _sw_a endif # find the account with the most files on the system if _sw_num_files_1 > _sw_sys_a_most_files then setvar _sw_sys_a_most_files _sw_num_files_1 setvar _sw_sys_aname_most_files _sw_a endif # echo some account detail based on level if _sw_lev_acct then echo setvar _sw_rec " Account !_sw_a summary (" if _sw_size_1 > $800000 then setvar _sw_rec _sw_rec+"![_sw_size_1/256] MB)" elseif _sw_size_1 < $800 then setvar _sw_rec _sw_rec+"![_sw_size_1*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_size_1*4] KB, & ![_sw_size_1/256] MB)" endif echo !_sw_rec if _sw_lev_vend and _sw_vend_a <> "" then echo contains !_sw_vend_a products endif setvar _sw_rec " # groups : !_sw_acct_num_grps" if _sw_acct_emp_grps > 0 then setvar _sw_rec _sw_rec+" (!_sw_acct_emp_grps empty)" endif echo !_sw_rec if _sw_acct_num_vs_grps > 0 then echo # grps on user vs: !_sw_acct_num_vs_grps endif if _sw_acct_num_dirs > 0 then echo # directories : !_sw_acct_num_dirs endif echo # files : !_sw_num_files_1 if _sw_num_files_1 > 0 then if _sw_acct_num_imgdb > 0 then echo # Image DBs : !_sw_acct_num_imgdb if _sw_lev_db then echo # DBs -!> DBEs : !_sw_acct_num_imgTC echo # jumbo DBs : !_sw_acct_num_jumbo echo # indexed DBs : !_sw_acct_num_idx setvar _sw_rec " Largest Image DB : & !_sw_acct_big_imgdb_name (" if _sw_acct_big_imgdb > $800000 then setvar _sw_rec _sw_rec+"![_sw_acct_big_imgdb/256] MB)" elseif _sw_acct_big_imgdb < $800 then setvar _sw_rec _sw_rec+"![_sw_acct_big_imgdb*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_acct_big_imgdb*4] KB, & ![_sw_acct_big_imgdb/256] MB)" endif echo !_sw_rec endif endif setvar _sw_rec " Largest group : !_sw_acct_big_gname (" if _sw_acct_big_grp > $800000 then setvar _sw_rec _sw_rec+"![_sw_acct_big_grp/256] MB)" elseif _sw_acct_big_grp = 0 then setvar _sw_rec _sw_rec+"groups contain only empty files)" elseif _sw_acct_big_grp < $800 then setvar _sw_rec _sw_rec+"![_sw_acct_big_grp*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_acct_big_grp*4] KB, & ![_sw_acct_big_grp/256] MB)" endif echo !_sw_rec setvar _sw_rec " Largest file : !_sw_acct_big_fname (" if _sw_acct_big_file > $800000 then setvar _sw_rec _sw_rec+"![_sw_acct_big_file/256] MB)" elseif _sw_acct_big_file = 0 then # all files in the acct have an eof=0, like /3000devs setvar _sw_rec _sw_rec+"all files have eof=0)" elseif _sw_acct_big_file < $800 then setvar _sw_rec _sw_rec+"![_sw_acct_big_file*4] KB)" else setvar _sw_rec _sw_rec+"![_sw_acct_big_file*4] KB, & ![_sw_acct_big_file/256] MB)" endif echo !_sw_rec echo Most files in : !_sw_acct_gname_most_files & (!_sw_acct_g_most_files) endif endif # reset acct counters setvar _sw_num_files_1 0 setvar _sw_num_files_2 0 setvar _sw_num_files_3 0 setvar _sw_num_files_4 0 setvar _sw_size_1 0 setvar _sw_size_2 0 setvar _sw_size_3 0 setvar _sw_size_4 0 setvar _sw_acct_num_grps 0 setvar _sw_acct_num_dirs 0 setvar _sw_acct_num_vs_grps 0 setvar _sw_acct_num_imgdb 0 setvar _sw_acct_num_imgTC 0 setvar _sw_acct_g_most_files 0 setvar _sw_acct_big_grp 0 setvar _sw_acct_big_file 0 setvar _sw_acct_big_imgdb 0 setvar _sw_acct_emp_grps 0 setvar _sw_acct_num_jumbo 0 setvar _sw_acct_num_idx 0 setvar _sw_in_acct false endif #echo !sysinfoz if hpcierr = 0 then # verify execute access print sysinfoz;start=-1 >sysinfox # read in the last record: "FOR USER.ACCT: bla, blah, blaah" input _sw_x 0) endif if _sw_haveX then # get sysinfo hdr, and optionally IO data now to use later purge sysinfoz;temp setvar hpcierr 0 if _sw_lev_io then continue xeq sysinfo.prvxl.telesup "io" >sysinfoz else continue xeq sysinfo.prvxl.telesup "exit" >sysinfoz endif if hpcierr <= 0 then print sysinfoz;start=6;end=13 endif endif if hpcierr > 0 or not _sw_haveX then # use CI vars and try to match sysinfo output echo -----------------------------------------------------------------& --------- echo echo System Information as of !hpdatef, !hptimef if hpcierr > 0 then echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: & Limited SysInfo, SYSINFO.PRVXL.TELESUP is missing, aborted or echo can't be run (cierr !hpcierr) # write to the error log file too. echo *** WARN !_sw_warn_cnt: & Limited SysInfo, SYSINFO.PRVXL.TELESUP failure (!hpcierr).& >>*!_sw_logf else echo *** WARN ![setvar(_sw_warn_cnt,_sw_warn_cnt+1)]: & Limited SysInfo, user lacks eXecute access to SYSINFO.PRVXL.SYS echo *** WARN !_sw_warn_cnt: Limited SysInfo, user lacks eXecute & access to SYSINFO.PRVXL.SYS >>*!_sw_logf endif echo MPE/iX HP31900!hprelversion OS: !hposversion User & Version: !hpversion echo CPU Model: !hpcpuname if hpuserlimit = -1 then echo Unlimited Users else echo User Limit: !hpuserlimit endif echo endif return endif return Version History: ---------------- X.01 Dec 01 JV First alpha version. X.02 Jan 02 JV Fixed uservol problem with undefined var; fixed /3000/devs where all files have eof=0; always show the # grps on user volsets in the summary report; rearranged the entry points in alphabetic order; got rid of leading "..." in directory names under each acct; disallow relative pathnames for the "what" parm; support a list of names for the level parm in addition to the bit mask integer values; made it faster by eliminating all :diskuse commands - replaced by just adding up file space in KB; Known Vendor Acct file assumed to be SWINVEND.PUB.SYS; DB pgm file assumed to be in PUB.SYS too; fixed DBE flag extraction bug; fixed HFS directory traversal bug; count space for files in dirs; count files directly under root; report Allbase files now. X.03 Jan 02 JV Test file exists before getting # sectors; made finfo calls more robust; added an OS version check to prevent usage on pre 6.0 PP1 systems; fixed dir level array element clearing bug in the dir exiting code which caused dir KB counts to be high; added most dir and biggest dir on system; accumulate dir space up to parent. X.04 Jan 02 JV The OS version test relied on hprelversion, which does not reliably have the powerpatch rev -- switched to testing existence of the hphhmmssmmm var; very minor output formatting changes; added display of some HP positive filecode files. X.05 Jan 02 JV Added user volumeset name to the "group" level output. Format changes to the KB size "group" output too. A.01 Jan 02 JV first release to HP3000-L; don't display qedit(fc=111) files; detect difference between missing Image datasets and datasets that have not yet been created; look for the swinvend (vendor) and swinvenp (db pgm) to be in the same group as the swinven script; re-gained performance lost when the file processing code was put into its own routine not, knowing that the whole script then ran 3 times slower -- so for the benefit of performance that routine is inlined again; added some more filecode displays for level="FILE". A.02 Feb 02 JV handle int overflow in disc space accumulation - a single acct, group or dir can now track 2^31(signed CI int)*2^20(MB units)=2^51 bytes of data; don't report empty groups or dirs. A.03 Feb 02 JV internally converted to pages(2^12) as the units of measure for disk space usage. The largest accumulation of disk space is 2^31(signed CI int)*2^12(bytes/page) = 2^43 bytes = 8 TB for any single acct, group or dir. A.02 version could count up to 2048 TB. Done to simplify and speed up the script; handle concurrent access to logfile by trying to detect and report it. B.00 Feb 02 JV FIRST RELEASE!; fixed output bug seen with 3000devs where groups are reported as empty and containing x files; add vendor info to acct summary; changed script name to SIU rather than SWINVEN; vendor-acct mapping file now named SIUVEND, DB pgm now named SIUDBP, logfile now named SIULOG; SIU=System Inventory Utility. B.01 Mar 02 JV fix more robust error handling when sysinfo.prvxl.telesup cannot be run; added more filecodes based on Stan Sieler's collection. B.02 May 02 JV added more acct->vendor mappings in SIUVEND thanks to Chris Bartram. B.03 May 03 JV fixed bug where SYSINFO.prvxl.telesup info was not displayed except on the first invocation of SIU in a job/session. This is due to a temp file used by SYSINFO named SINFOTMP. My guess is that SYSINFO purges this file at initialization time. If the file previously exists no error/warn occurs, when the file does not exist you get HPCIERR -383, which breaks the error logic in the "sys_info" entry of SIU. Changed SIU to procede if SYSINFO sets a warning value in HPCIERR. B.04 Jan 04 JV fixed a ">=" typo in filecode mapping code. B.05 Sep 05 JV added filecode 19787 for Easytime B.06 Apr 05 JV added support for KSAM/XL, KSAM64, CM KSAM (data) and other file types. Also changed some errors related to not being able to get info via finfo from errors to warnings.