key off
100 REM TO PRODUCE FILE SUMMARY OF HYDRO DATA**HYDFISUM**
110 DIM B$(20)
130 OPEN "o",#2,"fisum.OUT"
ff$=command$
150 SP$="   ":ASR$="           ":I=1
161 PRINT #2,TAB(20);"FILE SUMMARY - ";
163 PRINT #2, DATE$

240 PRINT #2, "FILE NAME:-"
cls:locate 5,5
250 PRINT "Enter ICES File Name; TYPE 'N' TO END ";:INPUT B$(I)
260 IF ucase$(B$(I))="N" THEN I=I-1:cls:GOTO 280
270 PRINT #2, B$(I):I=I+1:GOTO 250
280 PRINT #2, "Cou Ship  St Number";TAB(25);"Dates";TAB(35);"No of:03    56    P6    02";
285 PRINT  "Cou Ship  St Number";TAB(25);"Dates";TAB(35);"No of:03    56    P6    02";
290 PRINT #2, TAB(65);"Start";tab (71);"Number":PRINT #2,
295 PRINT TAB(65);"Start";tab(71);"Number":PRINT
300 FOR L=1 TO I

320 OPEN "i",#1,B$(L)
410 WHILE NOT EOF(1)
LINE INPUT #1, A$
420 A3$=MID$(A$,79%,2%)
if len(a$)<>80 then
 print #2,"record ";co-1;" has length of ";len(a$)
 print "record ";co-1;" has length of ";len(a$)
end if
430 IF A3$="4J" OR A3$="42" or a3$="91" or a3$="92" THEN 410
435 IF A3$="  " THEN PRINT "MISSING RECORD TYPE AT ";CO:PRINT #2,"MISSING RECORD ";CO:GOTO 410
440 CO=CO+1
if len(a$)<>80 then
 print #2,"record ";co;" has length of ";len(a$)
 print "record ";co;" has length of ";len(a$)
end if
450 IF A3$="0J" OR A3$="01"OR A3$="02"THEN MA$=LEFT$(A$,25%)
460 IF MA$=LEFT$(A$,25%) THEN 480
470 PRINT #2, "RECORD ";CO;" MISPLACED"
475 PRINT "RECORD ";CO;" MISPLACED":GOTO 410
480 A1$=LEFT$(A$,4%):AN$=MID$(A$,5%,4%):A2$=MID$(A$,19%,7%)
if ff$="-" then an$="    "
490 IF CO>1 THEN 540
500 IF A3$="0J" OR A3$="01" OR A3$="02" THEN 520
510 PRINT #2, "NOT A PROPER START"
515 PRINT "NOT A PROPER START":CO=0:GOTO 410
520 IF A3$="0J" OR A3$="01" THEN GOSUB 760:B1$=A1$:BN$=AN$:B2$=A2$:D1$=A1$:DN$=AN$:D2$=A2$:CS=CO:GOTO 410
530 IF A3$="02" THEN GOSUB 760:B1$=A1$:BN$=AN$:B2$=A2$:D1$=A1$:DN$=AN$:D2$=A2$:CS=CO:H4=H4+1:GOTO 410
540 IF A3$="0J" OR A3$="01" or a3$="02" THEN GOSUB 760
550 AY$=LEFT$(A2$,3%):DY$=LEFT$(D2$,3%)
560 IF A3$="0J" AND A1$=D1$ AND AN$>=DN$ AND A2$>=D2$ AND AY$=DY$ THEN D1$=A1$:DN$=AN$:D2$=A2$:GOSUB 710:GOTO 410
565 IF A3$="01" AND A1$=D1$ AND AN$>=DN$ AND A2$>=D2$ AND AY$=DY$ THEN D1$=A1$:DN$=AN$:D2$=A2$:GOSUB 710:GOTO 410
570 IF A3$="02" AND A1$=D1$ AND AN$>=DN$ AND A2$>=D2$ AND AY$=DY$ THEN D1$=A1$:DN$=AN$:D2$=A2$:GOSUB 710:H4=H4+1:GOTO 630
580 IF A3$="0J" OR A3$="01" THEN GOSUB 710:GOSUB 820:GOTO 410
590 IF A3$="02" THEN GOSUB 710:GOSUB 820:H4=H4+1:GOTO 410
600 IF A3$="03" OR A3$="13" OR A3$="83" OR A3$="93" THEN H1=H1+1
610 IF A3$="56" OR A3$="76" THEN H2=H2+1
620 IF A3$="P6" THEN H3=H3+1
630 ATR$=MID$(A$,5%,4%):ASR$=MID$(A$,19%,7%):CT=CO
640 GOTO 410

710 IF H1>0 THEN NH=NH+1:TH1=TH1+1:H1=0
720 IF H2>0 THEN NC=NC+1:TH2=TH2+1:H2=0
730 IF H3>0 THEN ND=ND+1:TH3=TH3+1:H3=0
740 IF H4>0 THEN NS=NS+1:TH4=TH4+1:H4=0
750 RETURN
760 'output routine
incr nstat
ypos=pos(1)
xpos=csrlin
locate 25,35:print nstat tab(42) " stations processed";
locate xpos,ypos
 F$=MID$(AN$,4%,1%)
770 H%=ASC(F$)
780 IF H%=125% THEN H%=48% : GOTO 800
790 IF H%>73% THEN H%=H%-25%
800 H$=CHR$(H%)
810 MID$(AN$,4%)=H$:RETURN
820 if ff$="-" then bn$="    ":atr$="    "
 PRINT #2, LEFT$(B1$,2%);SP$;MID$(B1$,3%,2%);SP$;BN$;"-";
825 PRINT LEFT$(B1$,2%);SP$;MID$(B1$,3%,2%);SP$;BN$;"-";
830 PRINT #2, ATR$;" ";B2$;"-";ASR$;
835 PRINT ATR$;" ";B2$;"-";ASR$;
840 PRINT #2, TAB(40);NH;TAB(46);NC;TAB(52);ND;TAB(58);NS;TAB(64);CS;TAB(72);CO-1-CS+1
845 PRINT TAB(40);NH;TAB(46);NC;TAB(52);ND;TAB(58);NS;TAB(64);CS;TAB(72);CO-1-CS+1
850 NH=0:NC=0:ND=0:NS=0
860 B1$=A1$:BN$=MID$(A$,5%,4%):B2$=A2$:D1$=A1$:DN$=AN$:D2$=A2$:CS=CO:RETURN
WEND
870 CLOSE #1
880 NEXT L
890 CO=CO+1:GOSUB 710:GOSUB 820
PRINT #2,:PRINT #2,TAB(30) "Total" tab(40) th1 tab(46) th2 tab(52) th3 tab(58) th4
PRINT TAB(30) "Total" tab(40) th1 tab(46) th2 tab(52) th3 tab(58) th4
900 CLOSE #2
print
locate ,10:print "Output is in file FISUM.OUT"
910 END
