1 ! 2! PROGRAM : QUOTA.BAS 3! VERSION : 1.0 4! DATE : 19-Apr-1982 5! AUTHOR : A. Frank Hattyar 10! Crocker National Bank & ! 155 Fifth Street & ! San Francisco, California 94103 & ! & ! This program is being provided to DECUS free of charge. Maintenance & ! of the program will be done by the author on a time-permitting basis. & ! If you have any bug fixes or enhancements to this program then please & ! send them to the author at the above address. & ! & 20 ! Modifications 100 ! Description 900 common (iosb) word iosb_status, fill(3%) & \ common (dqfls) long dqfls_flags, dqfls_uic, dqfls_usage, & dqfls_perm, dqfls_over, fill(3%) & \ map (dqfls) fill$ = 4%, word dqfls_member, dqfls_group & \ common (dqflr) long dqflr_flags, dqflr_uic, dqflr_usage, & dqflr_perm, dqflr_over, fill(3%) & \ map (dqflr) fill$ = 4%, word dqflr_member, dqflr_group & \ map (dqflr) dqflr_buf$ = 32% & \ common (fib) long fib_acctl, word fib_fid(2%), fib_did(2%), & long fib_wcc, word fib_nmctl, fib_cntrlfunc, & long fib_cntrlval, fib_exvbn, long fib_rest(2%) & \ common (descr) long iosb_len, iosb_addr, dqfls_len, dqfls_addr, & dqflr_len, dqflr_addr, fib_len, fib_addr & \ map (pointers) long ptr(300%,1%) & \ map (pointers) word grp_mem(300%,3%) & \ map (pointers) ptr$(300%) = 8% & \ map (pointers) ptr_buf$ = 2408% & \ common (quota) word q_member, q_group, long q_time(1%), q_usage(9%), & q_perm(9%), q_interval & \ map (quota) q_buf$ = 96% & \ common (quad) time_now%(1%), interval%(1%), wake_time%(1%), & qa%(1%), qb%(1%), sample_time%(1%) & \ iosb_len = 8% & \ fib_len = 44% & \ dqfls_len, dqflr_len = 32% & \ iosb_addr = loc(iosb_status) & \ dqfls_addr = loc(dqfls_flags) & \ dqflr_addr = loc(dqflr_flags) & \ fib_addr = loc(fib_acctl) & \ on error goto 19000 & ! & ! Maps and data structures needed for getting quota info & ! & 910 dim usage%(300%,5%), quota%(300%,5%) & \ external integer function sys$assign, & sys$asctim, & sys$bintim, & sys$gettim, & sys$hiber, & sys$schdwk, & sys$qiow, & mth$iior, & lib$stop, & lib$execute_cli, & utl_day_of_week, & utl_dec_oct & \ external integer constant io$_acpcontrol, & fib$c_exa_quota, & fib$m_all_mem, & fib$m_all_grp, & ss$_nodiskquota, & ss$_normal & \ declare word w_len, w_grp, w_mem & ! & ! Externals & ! & 920 disk$(0%) = "DRA0:" & \ disk$(1%) = "DRA1:" & \ disk$(2%) = "DRB2:" & \ disk$(3%) = "DRB3:" & \ disk$(4%) = "DRB4:" & \ disk$(5%) = "DRB5:" & \ disks% = 6% & \ fib_cntrlfunc = fib$c_exa_quota & \ w_grp = fib$m_all_grp & \ w_mem = fib$m_all_mem & \ w_len = mth$iior(w_mem by ref, w_grp by ref) & \ fib_cntrlval = w_len & \ interval%(0%) = 1640261632% & \ interval%(1%) = 8% & \ interval% = 3600% & ! & ! Disk names and data collection intervals & ! & 1000 open "s_raw:quota.dat" as file #1%, map quota, & organization sequential fixed, & recordsize 96% & ! & ! Open the file & ! & 1010 get #1% & \ qa%(i%) = q_time(i%) for i% = 0% to 1% & \ goto 1010 & ! & ! and loop through it until we get to the last entry & ! (how crude .....) & ! & 1020 last_sample_day$ = string$(3%,0%) & \ goto 1030 if (qa%(0%) = 0%) and (qa%(1%) = 0%) & \ sts% = utl_day_of_week(last_sample_day$, qa%(0%), qa%(1%)) & ! & ! Determine day of week of last entry & ! & 1030 open "s_raw:quota.dat" as file #1%, map quota, access append, & organization sequential fixed, & recordsize 96% & ! & ! Reopen the file and point to the end & ! & 1040 t$ = string$(11%,0%) & \ sts% = sys$asctim(,t$,,1%) & \ hour% = pos(t$,":",1%) & \ wake_time$ = "-- " + left(t$,hour%-1%) + ":59:59.99" & \ sts% = sys$bintim(wake_time$,wake_time%(0%)) & \ sts% = sys$schdwk(,,wake_time%(0%),) & \ sts% = sys$hiber & ! & ! Get the current time and sleep until the end of the & ! hour (really crude ....) & ! & 2000 next_entry% = 1% & \ ptr_buf$ = string$(2408%,0%) & \ sts% = sys$gettim(sample_time%(0%)) & \ for i% = 0% to disks% - 1% & \ sts% = sys$assign(disk$(i%),chan%,,) & ! & ! We assign a channel for each disk device & ! & 2010 dqflr_buf$ = string$(32%,0%) & \ sts% = sys$qiow(,chan% by value, io$_acpcontrol by value, & iosb_addr by value,,, fib_len by ref, & dqfls_len by ref, w_len, dqflr_len by ref,,) & \ goto 2040 if iosb_status = ss$_nodiskquota & \ if dqflr_uic = 0% & then & usage%(0%,i%) = dqflr_usage & \ quota%(0%,i%) = dqflr_perm & \ goto 2010 & else & for j% = 1% to 300% & \ goto 2030 unless ptr(j%,0%) & \ if ptr(j%,0%) = dqflr_uic & then & usage%(j%,i%) = dqflr_usage & \ quota%(j%,i%) = dqflr_perm & \ goto 2010 & ! & ! Get the quota for each UIC. If we find that UIC in our array & ! then we just enter the quota for the current disk. & ! & 2020 next j% & ! & ! Next entry & ! & 2030 ptr(next_entry%,0%) = dqflr_uic & \ usage%(next_entry%,i%) = dqflr_usage & \ quota%(next_entry%,i%) = dqflr_perm & \ next_entry% = next_entry% + 1% & \ goto 2010 & ! & ! Create a new entry if we haven't seen this UIC before & ! & 2040 fib_wcc = 0% & \ next i% & \ total_entries% = next_entry% - 1% & \ temp$ = string$(8%,0%) & ! & ! We're all done and we total up the entries & ! & 3000 ptr(i%,1%) = i% for i% = 0% to total_entries% & 3010 sort_done% = -1% & \ for i% = 1% to total_entries% - 1% & \ if ptr(i%,0%) > ptr(i%+1%,0%) & then & temp$ = ptr$(i%) & \ ptr$(i%) = ptr$(i%+1%) & \ ptr$(i%+1%) = temp$ & \ sort_done% = 0% & ! & ! Super crude ........ a really old fashioned bubble sort & ! (No - it's not for Lawrence Welk ...) & ! & 3020 next i% & \ goto 3010 unless sort_done% & \ gosub 4000 & \ for i% = 0% to total_entries% & \ q_buf$ = string$(96%,0%) & \ sts% = utl_dec_oct(grp_mem(i%,0%) by ref, q_member by ref) & \ sts% = utl_dec_oct(grp_mem(i%,1%) by ref, q_group by ref) & \ q_time(j%) = sample_time%(j%) for j% = 0% to 1% & \ q_usage(j%) = usage%(ptr(i%,1%),j%) & for j% = 0% to disks% - 1% & \ q_perm(j%) = quota%(ptr(i%,1%),j%) & for j% = 0% to disks% - 1% & \ q_interval = interval% & \ put #1% & \ next i% & ! & ! This program really puts out ..... & ! & 3030 time_now%(i%) = wake_time%(i%) for i% = 0% to 1% & \ call addquad(time_now%(0%),interval%(0%),wake_time%(0%)) & \ sts% = sys$schdwk(,,wake_time%(0%),) & \ sts% = sys$hiber & !\ print "starting loop", wake_time%(i%) for i% = 0% to 1% & \ goto 2000 & ! & ! reschedule for beddy-bye ZZZzzzzzzzz....... & ! & 4000 current_day$ = string$(3%,0%) & \ sts% = utl_day_of_week(current_day$, sample_time(0%),sample_time(1%)) & \ if current_day$ = "SAT" & then & goto 4010 if last_sample_day$ = "SAT" & \ goto 4010 if edit$(last_sample_day$,-1%) = "" & \ close #1% & \ command_1$ = "$ RENAME S_RAW:QUOTA.DAT S_RAW:QUOTAS.DAT" & \ command_2$ = "$ SUBMIT/QUE=SYS$FAST S_HOME:QUOTAWEEK" & \ command_3$ = "$ LOGO" & \ sts% = lib$execute_cli(command_1$, command_2$, command_3$) & \ open "s_raw:quota.dat" for output as file #1%, & map quota, & organization sequential fixed, & recordsize 96% & ! & ! Rename the file and start the job if the weekly period & ! is up & ! & 4010 last_sample_day$ = current_day$ & \ return & ! & ! Update they day info and return from whence we came & ! & 19000 if err = 11% and erl = 1010 then resume 1020 else print ert$(err), elr & ! & ! Heavy duty error handling here & ! & 32767 end