1 ! 2! PROGRAM : QUOTAMON.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 (quotin) word q_group, q_member, long q_date(1%), & q_usage(9%), q_perm(9%), q_interval & \ map (quotin) long q_uic & \ map (wquota) word w_group, w_member, long w_date(1%), & w_usage(9%), w_perm(9%), w_usemax(9%), & w_samples, w_interval & \ map (wquota) long w_uic & \ map (wquota) w_buf$ = 140% & \ map (tquota) word t_group, t_member, long t_date(1%), & t_usage(9%), t_perm(9%), t_usemax(9%), & t_samples, t_interval, t_usemaxuic(9%) & \ map (tquota) t_buf$ = 180% & \ map (quad) qa0%, qa1%, qb0%, qb1%, qc0%, qc1%, qd0%, qd1% & 910 external integer function sys$asctim, & sys$bintim, & sys$gettim, & lib$day, & lib$get_input & \ external integer constant ss$_normal & ! & ! Define externals for identifying accounting record type & ! and a few functions that'll be used. & ! & 920 dim perm%(9%) & ! & ! For keeping track of the last quota figures & ! & 1000 open "s_sort:quomonsrt.dat" for input as file #1%, & map quotin, organization undefined, recordtype any & \ open "s_summary:quomonuic.dat" as file #2%, map wquota, & access append, organization sequential fixed, & recordsize 140% & \ open "s_summary:quomontot.dat" as file #3%, map tquota, & access append, organization sequential fixed, & recordsize 180% & \ t_buf$ = string$(180%,0%) & \ w_buf$ = string$(140%,0%) & \ count%, done% = 0% & \ qb0% = 711573504% ! this is the factor for & \ qb1% = 201% ! subtracting 24 hours & \ get #1% & \ previous_uic% = q_uic & \ interval% = q_interval & \ 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% & ! & ! Figure out our current month and then go back one & ! for the default & ! & 1005 default_date$ = seg$(months$,(month%*3%)-2%, month%*3%) + "-" + & num$(year%) & \ default_date$ = edit$(default_date$,-1%) & ! & ! Get the prompt string ready & ! & 1010 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" & ! & ! Get the verdict and set it up for binary time conversion & ! & 1015 sts% = sys$bintim(a$,qa0%) & \ goto 1010 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% & ! & ! Figure the next month after the one that was promted for & ! & 1020 a$ = " 1-" + seg$(months$,(month%*3%)-2%,month% * 3%) + "-" + & edit$(num$(year%),-1%) + " 00:00:00.00" & \ sts% = sys$bintim(a$,qa0%) & \ call subquad(qa0%,qb0%,qc0%) & \ sts% = lib$day(stop_date%,qc0%) & \ stop_time0% = qc0% & \ stop_time1% = qc1% & ! & ! Get the start and stop dates & ! & 1030 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 1030% & ! & ! 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. & ! & 2000 sts% = lib$day(compare_date%, q_date(0%),) & \ goto 2100 if (compare_date% < start_date%) if selections% & \ goto 2100 if (compare_date% > stop_date%) if selections% & \ w_samples = w_samples + 1% & \ for i% = 0% to 9% & \ w_usage(i%) = w_usage(i%) + q_usage(i%) & \ w_usemax(i%) = q_usage(i%) if q_usage(i%) > w_usemax(i%) & \ perm%(i%) = q_perm(i%) & \ next i% & ! & ! Select a record if we are doing selections & ! & 2100 get #1% & \ goto 2000 if previous_uic% = q_uic & ! & ! Go back if the same UIC & ! & 2110 w_uic = previous_uic% & \ w_date(0%) = stop_time0% & \ w_date(1%) = stop_time1% & \ w_interval = interval% & \ w_perm(i%) = perm%(i%) for i% = 0% to 9% & \ w_samples = 1 if w_samples = 0% & \ w_usage(i%) = w_usage(i%)/w_samples for i% = 0% to 9% & \ put #2% & \ for i% = 0% to 9% & \ t_usage(i%) = t_usage(i%) + w_usage(i%) & \ t_perm(i%) = t_perm(i%) + perm%(i%) & \ if w_usemax(i%) > t_usemax(i%) & then & t_usemax(i%) = w_usemax(i%) & \ t_usemaxuic(i%) = w_uic & ! & ! Do our totaling and maximums & ! & 2120 next i% & \ w_buf$ = string$(140%,0%) & \ t_samples = w_samples & \ previous_uic% = q_uic & \ goto 2000 unless done% & \ t_date(0%) = stop_time0% & \ t_date(1%) = stop_time1% & \ t_interval = interval% & \ put #3% & \ close #1%, #2%, #3% & \ goto 32767 & ! & ! Close up shop and leave & ! & 19000 if err = 11% and erl = 2100% then done% = -1% & \ resume 2110 & 19090 print ert$(err); " at line ";erl & \ on error goto 0 & ! & ! The coward's way out .... & ! & 32767 end