10	! PROGMON.BAS
	! PROGRAM (PARTIAL) TO ACCUMULATE A 3 DIMENSIONAL
	! ARRAY OF PROGRAMMER TIME BY PROJECT, DAY OF MONTH
	! AND PROGRAMMER. ARRAY ELEMENTS ARE INTEGERS CONTAINING
	! TIME IN UNITS OF HUNDREDTHS OF AN HOUR.
	!
	! SIZE OF ARRAY: (60+1)PROJECTS * (31+1)DAYS * (10+1)PROGRAMMERS=21472
	!
	! THIS PROGRAM IS MEANT TO BE CHAINED TO BY ANOTHER PROGRAM
	! WHICH WILL HAVE SET UP CERTAIN THINGS AND DECIDED THAT THE
	! 3 DIMENSIONAL ARRAY NEEDS TO BE CREATED.
	!
	! FOLLOWING IS A LIST OF THOSE THINGS WHICH NEED TO BE
	! DONE BY THE PROGRAM WHICH CHAINS TO THIS ONE:
	!
	! DIM #16,PR%(21472)
	! DIM M$[3](12),M&(12)
	! DIM R$[60]V
	!
	! M$ AND M& INITIALIZED WITH 3 CHAR MONTH NAMES AND
	!    NUMBER OF DAYS PER MONTH RESPECTIVELY.
	!
	! FY&=FISCAL YEAR OF INTEREST
	! Y& =CALENDAR YEAR OF INTEREST
	! M& =MONTH OF INTEREST
	!
	! CH$=STRING FOR CHAIN WHEN DONE WITH THIS CODE
	!
110 DIM NP$[40]V,DP$[4]V
300 NP=5 : NP$="LAR/BON/DEA/BEV/DAN"
320 ! CHANGED 3-JUL-81
	NP=3 : NP$="DEA/CLW/DAN"
340 ! CHANGED 3-JUL-84
	NP=1 : NP$="DAN"
360 P1=2 : P2=6		! DEFINE LOWER, UPPER BOUNDS ON PROGRAMMER NUMBERS
1000 F$="LOGTEMP.F"+STR$(FY&)
1010 OPEN #3,F$+"/FX/LN:60/WR"
1020 CLOSE 3
1030 FOR II=1 TO NP
1040 S=0
1050 CALL "SPAWNB"("PIP "+F$+"=[2,1]LOG"+PIECE$(NP$,"/",II)+".F"+STR$(FY&)+"/AP",S)
1060 IF S < 1 THEN PRINT "S=";S : STOP
1070 NEXT II
1080 S=0
1090 CALL "SPAWNB"("SRT "+F$+"="+F$+"/SI:60/PR:T/KE:52.2:48.4:1.4",S)
1100 IF S < 1 THEN PRINT "S=";S : STOP
1200 OVERLAY "PROJNUM/RT" 
1205 OPEN #16,M$(M&)+STR$(Y&)+".VPG/WR/BL" : GOSUB 1400
1208 F$="LOGTEMP.F"+STR$(FY&)
1210 OPEN #3,F$+"/RO/FX/LN:60/EN:1500"
1220 DEF FNSU(PJ,DA,PG)=(PJ*32+DA)*11+PG
1230 INPUT LINE #3,R$
1240 IF VAL(SBS$(R$,52,2))<>Y& OR VAL(SBS$(R$,48,2))<>M& THEN 1230
	ELSE 1260
	! LOOP ONCE WE FOUND FIRST GOOD RECORD
1250 INPUT LINE #3,R$
	! CHECK FOR PROPER MONTH AND YEAR
1260 IF VAL(SBS$(R$,52,2))<>Y& OR VAL(SBS$(R$,48,2))<>M& THEN 1500
	! GET PROJECT SUBSCRIPT
1270 DP$=TRM$(SBS$(R$,1,4)) : GOSUB 8000
1280 IF DP% < 1 OR DP% > 60 THEN PRINT R$ : PRINT "DP%=";DP% : GOTO 1330
	! GET DAY SUBSCRIPT
1290 DA%=VAL(SBS$(R$,50,2)) : IF DA%<1 OR DA%>M&(M&) THEN
	PRINT R$ : PRINT "DA%=";DA% : GOTO 1330
	! GET PROGRAMMER SUBSCRIPT
1300 PG%=VAL(SBS$(R$,47,1)) : IF PG%<P1 OF PG%>P2 THEN
	PRINT R$ : PRINT "PG%=";PG% : GOTO 1330
	! GET HUNDREDTHS OF HOURS
1310 HR%=INT(VAL(SBS$(R$,54,5))*100+.5)
1320 PR%(FNSU(DP%,DA%,PG%))=HR%+PR%(FNSU(DP%,DA%,PG%))
1330 GOTO 1250
1400 DIM #16,PR(10736)
1405 FOR II= 10736 TO 0 STEP -1
1410 PR(II)=0 : NEXT II
1420 RETURN
1500 CLOSE : CHAIN CH$
