1 ! 2! PROGRAM : QUOTAWEEK.BAS 3! VERSION : 1.0 4! DATE : 7-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, & utl_day_of_week & \ external integer constant ss$_normal & ! & ! Define externals for identifying accounting record type & ! and a few functions that'll be used. & ! & 920 dim perm%(9%) & ! & ! Keep track of the last quota & ! & 1000 open "s_sort:quoweesrt.dat" for input as file #1%, & map quotin, organization undefined, recordtype any & \ open "s_summary:quoweeuic.dat" as file #2%, map wquota, & access append, organization sequential fixed, & recordsize 140% & \ open "s_summary:quoweetot.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% & \ qa0% = 711573504% ! this is the factor for & \ qa1% = 201% ! subtracting 24 hours & \ get #1% & \ previous_uic% = q_uic & \ interval% = q_interval & \ sts% = sys$gettim(qd0%) & \ day_of_week$ = string$(0%,3%) & \ sts% = utl_day_of_week(day_of_week$,done%,done%) & \ p% = pos("SATSUNMONTUEWEDTHUFRI", day_of_week$, 1%)/3% + 1% & \ qb0% = p% & \ qb1% = 0% & \ call multquad(qa0%,qb0%,qc0%) & \ call subquad(qd0%,qc0%,qa0%) & \ default_date$ = string$(11%,0%) & \ sts% = sys$asctim(,default_date$,qa0%,) & ! & ! Open our files, both the user-by-user summary and the overall & ! system summary. Figure out today's date and day and set up & ! our defaults to the previous Friday. If today is Friday then & ! we default to last Friday. (Eh ? Robinson Crusoe ?) & ! & 1010 prompt$ = "Week ending (dd-mmm-yyyy) <" + default_date$ + "> : " & \ sts% = lib$get_input(a$,prompt$,) & \ if edit$(a$,-1%) <> "" & then & a$ = edit$(a$, 4% + 8% + 16% + 32% + 128%) & \ a$ = a$ + " 00:00:00.00" & \ sts% = sys$bintim(a$,qa0%) & \ goto 1010 if sts% <> ss$_normal & else & a$ = default_date$ + " 00:00:00.00" & \ sts% = sys$bintim(a$,qa0%) & ! & ! We now prompt for the date and only let them enter & ! month, day and year. The time is place at zero to & ! make it nicer for certain DATATRIEVE operations. & ! & 1020 sts% = lib$day(stop_date%,qa0%) & \ start_date% = stop_date% - 6% & \ stop_time0% = qa0% & \ stop_time1% = qa1% & ! & ! Based on the above information we figure out the start & ! and stop day for our selections. & ! & 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 for more if we are dealing with the same user & ! & 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 & ! & ! Total it all up for this guy & ! & 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