1 ! 2! PROGRAM : STATMONTH.BAS 3! VERSION : 1.0 4! DATE : 12-Apr-1982 5! AUTHOR : A. Frank Hattyar 20 ! Modifications 100 ! Description 900 on error goto 19000 & \ map (statrec) s_null%, ! time that null job ran & s_uptime%, ! length of this sample period (secs) & s_dirio%, ! number of direct I/O's & s_bufio%, ! number of buffered I/O's & s_lognam%, ! number of logical name translations & s_mbxrds%, ! number of mailbox reads & s_mbxwrt%, ! nunber of mailbox writes & s_iop%, ! number of I/O Packets used & s_fremin%, ! minimum number of free pages & s_fremax%, ! maximum number of free pages & s_freave%, ! average number of free pages & s_modmin%, ! minimum number of modified pages & s_modmax%, ! maximum number of modified pages & s_modave%, ! average number of modified pages & s_filmin%, ! minimum number of open files & s_filmax%, ! maximum number of open files & s_filave%, ! average number of open files & s_switch%, ! number of context switches (N/A) & s_faults%, ! number of page faults & s_preads%, ! number of page reads & s_prdios%, ! number of page read I/O's & s_pwrts%, ! number of page writes & s_pwrios%, ! number of page write I/O's & s_dzero%, ! number of demand zero faults & s_kernel%, ! time in kernel mode (10 ms units) & s_exec%, ! time in executive mode & s_super%, ! time in supervisor mode & s_user%, ! time in user mode & s_inter%, ! time on the interrupt stack & s_compat%, ! time in compatibility mode & s_sysflt%, ! number of system faults & s_window%, ! number of window turns & s_fopens%, ! number of file opens & fill$ = 280%, ! reserved for FCP stats & s_disks%(9%), ! number of operations for 9 disks & s_date%(1%), ! sample time & fill$ = 52% ! expansion room & ! & ! We set up the next buffer in the same way & ! & \ map (wstat) w_null%, w_uptime%, w_dirio%, w_bufio%, w_lognam%, & w_mbxrds%, w_mbxwrt%, w_iop%, w_fremin%, w_fremax%, & w_freave%, w_modmin%, w_modmax%, w_modave%, & w_filmin%, w_filmax%, w_filave%, w_switch%, & w_faults%, w_preads%, w_prdios%, w_pwrts%, w_pwrios%, & w_dzero%, w_kernel%, w_exec%, w_super%, w_user%, & w_inter%, w_compat%, w_sysflt%, w_window%, w_fopens%, & fill$ = 280%, w_disks%(9%), w_date%(1%), & w_samples%, fill$ = 48% & ! & ! We add use one more longword then the previous buffer & ! for the number of samples used to compute the summary & ! rec & ! & \ map (quad) qa0%, qa1%, qb0%, qb1%, qc0%, qc1% , qd0%, qd1% & ! & ! Workspace for quad date stuff & ! & 920 external integer function sys$bintim, & sys$asctim, & sys$gettim, & lib$day, & lib$get_input & \ external integer constant ss$_normal & ! & ! Some externals & ! & 1000 open "s_sort:statapp.dat" for input as file #1%, map statrec, & organization undefined, recordtype any & \ open "s_summary:statmonth.dat" as file #2%, map wstat, & access append, & organization sequential fixed, & recordsize 512% & ! & ! Open our input and output files & ! & 1010 qa0% = 711573504% & \ qa1% = 201% & \ months$ = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" & \ d$ = string$(11%,0%) & \ sts% = sys$asctim(,d$,,) & \ month$ = seg$(d$,4%,6%) & \ month% = pos(months$,month$,1%)/3% + 1% & \ year% = val%(seg$(d$,8%,11%)) & \ month% = month% - 1% & \ if month% = 0% & then & month% = 12% & \ year% = year% - 1% & 1015 default_date$ = seg$(months$,(month%*3%)-2%, month%*3%) + "-" + & num$(year%) & \ default_date$ = edit$(default_date$,-1%) & 1020 prompt$ = "Month to process (mmm-yyyy) <" + default_date$ + "> : " & \ sts% = lib$get_input(a$,prompt$,) & \ a$ = edit$(a$,-1%) & \ if a$ = "" & then & a$ = " 1-" + default_date$ + " 00:00:00.00" & else & a$ = " 1-" + a$ + " 00:00:00.00" & 1025 sts% = sys$bintim(a$,qa0%) & \ goto 1020 if sts% <> ss$_normal & \ sts% = lib$day(start_date%,qa0%) & \ month% = pos(months$,seg$(a$,4%,6%),1%)/3%+1% & \ year% = val%(seg$(a$,8%,11%)) & \ month% = month% + 1% & \ if month% = 13% & then & month% = 1% & \ year% = year% + 1% & 1030 a$ = " 1-" + seg$(months$,(month%*3%)-2%,month% * 3%) + "-" + & edit$(num$(year%),-1%) + " 00:00:00.00" & \ sts% = sys$bintim(a$,qa0%) & \ qb0% = 711573504% & \ qb1% = 201% & \ call subquad(qa0%,qb0%,qc0%) & \ sts% = lib$day(stop_date%,qc0%) & \ stop_time0% = qc0% & \ stop_time1% = qc1% & 1040 prompt$ = "Process" + ht + "1) All records in file (A)" + cr + lf + & ht + ht + "2) Selected in the interval (S)" + ht + & " : " & \ sts% = lib$get_input(a$,prompt$,) & \ a$ = edit$(a$,-1%) & \ if (a$ = "") or (a$ = "A") & then & selections% = 0% & else & if a$ = "S" & then & selections% = -1% & else & goto 1040% & ! & ! We can choose to just process the records that fall in & ! the start day/stop day range or to process all the records & ! in the file and just plug in the date entered as the date & ! in the summary record. This may be helpful in fixing messes & ! like operators accidentally entering the wrong date. & ! & 1050 w_null%, w_uptime%, w_dirio%, w_bufio%, w_lognam%, & w_mbxrds%, w_mbxwrt%, w_iop%, w_fremax%, & w_freave%, w_modmax%, w_modave%, & w_filmax%, w_filave%, w_switch%, & w_faults%, w_preads%, w_prdios%, w_pwrts%, w_pwrios%, & w_dzero%, w_kernel%, w_exec%, w_super%, w_user%, & w_inter%, w_compat%, w_sysflt%, w_window%, w_fopens%, & w_samples% = 0% & \ w_disk%(i%) = 0% for i% = 0% to 9% & \ w_date%(i%) = 0% for i% = 0% to 1% & \ w_fremin%, w_modmin%, w_filmin% = 25526772% & \ count% = 0% & ! & ! Zero the buffer and set up large values for minimums & ! (all done the hard way ...) & ! & 2000 get #1% & \ sts% = lib$day(compare_date%,s_date%(0%),) & \ goto 2000 if compare_date% < start_date% if selections% & \ goto 2000 if compare_date% > stop_date% if selections% & \ w_samples% = w_samples% + 1% & \ w_null% = w_null% + s_null% & \ w_uptime% = w_uptime% + s_uptime% & \ w_dirio% = w_dirio% + s_dirio% & \ w_bufio% = w_bufio% + s_bufio% & \ w_lognam% = w_lognam% + s_lognam% & \ w_mbxrds% = w_mbxrds% + s_mbxrds% & \ w_mbxwrt% = w_mbxwrt% + s_mbxwrt% & \ w_iop% = w_iop% + s_iop% & \ w_fremin% = s_fremin% if s_fremin% < w_fremin% & \ w_fremax% = s_fremax% if s_fremax% > w_fremax% & \ w_freave% = w_freave% + s_freave% & \ w_modmin% = s_modmin% if s_modmin% < w_modmin% & \ w_modmax% = s_modmax% if s_modmax% > w_modmax% & \ w_modave% = w_modave% + s_modave% & \ w_filmin% = s_filmin% if s_filmin% < w_filmin% & \ w_filmax% = s_filmax% if s_filmax% > w_filmax% & \ w_filave% = w_filave% + s_filave% & \ w_switch% = w_switch% + s_switch% & \ w_faults% = w_faults% + s_faults% & \ w_preads% = w_preads% + s_preads% & \ w_prdios% = w_prdios% + s_prdios% & \ w_pwrts% = w_pwrts% + s_pwrts% & \ w_pwrios% = w_pwrios% + s_pwrios% & \ w_dzero% = w_dzero% + s_dzero% & \ w_kernel% = w_kernel% + s_kernel% & \ w_exec% = w_exec% + s_exec% & \ w_super% = w_super% + s_super% & \ w_user% = w_user% + s_user% & \ w_inter% = w_inter% + s_inter% & \ w_compat% = w_compat% + s_compat% & \ w_sysflt% = w_sysflt% + s_sysflt% & \ w_window% = w_window% + s_window% & \ w_fopens% = w_fopens% + s_fopens% & \ w_disks%(i%) = w_disks%(i%) + s_disks%(i%) for i% = 0% to 9% & \ count% = count% + 1% & \ goto 2000 & ! & ! Get a record, do all the totals, and go back for more & ! & 2010 w_date%(0%) = stop_time0% & \ w_date%(1%) = stop_time1% & \ w_freave% = w_freave% / count% & \ w_modave% = w_modave% / count% & \ w_filave% = w_filave% / count% & \ put #2% & \ print "Count = "; count% & \ close #1%, #2% & \ goto 32767 & ! & ! Plug in the time and write out the data & ! & 19000 if err = 11% and erl = 2000% then resume 2010% else print err,erl,ert$(err) & ! & ! A little (very little) error handling ... & ! & 32767 end