1 CLS:PRINT TAB(10);"INSURANCE POLICY FILE":PRINT
2 PRINT"THIS SIMPLE PROGRAM WILL PERMIT THE INDIVIDUAL OR SMALL
3 PRINT"BUSINESS TO STORE DATA ABOUT THE PORTFOLIO OF ALL INSURANCE
4 PRINT"POLICIES HELD. FOR EACH POLICY THE FOLLOWING DATA MAY BE 
5 PRINT"STORED: TYPE INSURANCE,DESCRIPTION,DATE EXPIRES,INSURANCE
6 PRINT"COMPANY,UNDERWRITER, POLICY NUMBER, FACE AMOUNT, AND ANNUAL
7 PRINT"PREMIUM. THE FILE MAY BE STORED ON CASSETTE OR DISKETTE AND
8 PRINT"RECALLED. THE POLICIES MAY BE LISTED EITHER IN FULL OR BY TYPE
9 PRINT"WITH SUMMARIES OF TOTAL POLICY FACE VALUES AND PREMIUMS.
10 PRINT"A PROVISION FOR A MAXIMUM OF 70 POLICIES IS MADE."
15 PRINT:INPUT"PRESS ENTER TO BEGIN";Z9$
50 CLEAR 1000
55 DEFDBL B,V
60 DIM A$(70,6),B(70,3)
65 DIM AT$(70,6),BT(70,3)
70 GOSUB 9000
100 CLS:INPUT"ARE DISK DRIVES ATTACHED(Y/N)";ZD$
110 IF ZD$<>"Y" AND ZD$<>"N" THEN GOSUB 10000:GOTO 100
500 CLS:PRINT"       MAIN MENU":PRINT
505 PRINT" 0.QUIT
510 PRINT" 1.ADD TO FILE OR BEGIN NEW FILE
520 PRINT" 2.READ FILE IN FROM TAPE
530 PRINT" 3.WRITE FILE OUT ONTO TAPE
540 PRINT" 4.READ FILE IN FROM DISK
550 PRINT" 5.WRITE FILE OUT ONTO DISK
560 PRINT" 6.EDIT FILE
570 PRINT" 7.LIST CONTENTS, COMPLETE OR BY TYPE
580 PRINT" 8.ROUTINE ACTUALLY DELETING RECORD FROM FILE
590 Z9=0
600 INPUT"ENTER YOUR CHOICE";Z9
605 IF Z9 = 0 THEN END
610 ON Z9 GOSUB 1000,2000,2100,2200,2300,3000,5000,7000
620 GOTO 500
1000 REM ADD TO OR START FILE ALREADY IN MEMORY
1010 CLS: IF NI=0 THEN PRINT "NEW FILE":GOSUB 10100
1015 J=NI+1
1020 GOSUB 6000:REM INPUT 1 RECORD
1030 CLS:PRINT F$(2):GOSUB 6100:REM PRINT OUT 1 RECORD
1040 GOSUB 10200:IF Z9$="N" GOTO 1020
1050 IF Z9$="A" THEN RETURN
1060 NI=NI+1:REM NEW RECORD ON FILE
1070 GOSUB 10400:REM MORE?
1080 IF Z9$="Y" THEN GOTO 1000 ELSE RETURN
2000 REM READ IN FILE FROM TAPE
2010 CLS:PRINT"PUT DATA TAPE IN TAPE DRIVE":GOSUB 10100
2015 ' IF ZD$="Y" THEN CMD"T"
2020 INPUT #-1,NI
2030 FOR J=1 TO NI:INPUT #-1,A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2),B(J,3):NEXT
2040 RETURN
2100 REM WRITE OUT FILE ONTO TAPE
2105 CLS
2110 PRINT"PUT DATA TAPE IN TAPE DRIVE":GOSUB 10100
2115 ' IF ZD$="Y" THEN CMD"T"
2130 WRITE #-1,NI
2140 FOR J=1 TO NI:WRITE #-1,A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2),B(J,3):NEXT
2150 RETURN
2200 REM READ IN FILE FROM DISK
2210 CLS:PRINT"PUT DATA DISK IN DISK DRIVE":GOSUB 10100
2220 ON ERROR GOTO 2290
2225 PRINT:INPUT"ENTER NAME OF FILE TO READ IN";FI$
2230 OPEN"I",1,FI$
2240 INPUT #1,NI
2250 FOR J=1 TO NI:INPUT #1,A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2),B(J,3):FOR JJ=1 TO 6:Z8$=A$(J,JJ):GOSUB 11000:A$(J,JJ)=Z8$:NEXT JJ:NEXT
2260 CLOSE #1
2270 RETURN
2290 PRINT "FILE DOES NOT EXIST":GOSUB 10100:RETURN
2300 REM WRITE FILE OUT TO DISK
2305 CLS
2310 PRINT:PRINT"PUT DATA DISK IN DISK DRIVE":GOSUB 10100
2315 PRINT:PRINT"PRESENT DISK FILE IS ";FI$;" ";:INPUT"NEW FILE ";FI$
2320 OPEN"O",1,FI$
2330 WRITE # 1,NI
2340 FOR J=1 TO NI
2350 WRITE # 1,A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2),B(J,3)
2360 NEXT J
2370 CLOSE #1
2380 RETURN
3000 REM EDIT FILE
3010 CLS:PRINT"   ";F$(2)
3020 FOR J=1 TO NI
3030 PRINT USING "## ";J;
3040 GOSUB 6100
3050 IF J/12=INT(J/12) THEN GOSUB 4000
3060 NEXT J
3062 J=J-1
3065 IF J/12=INT(J/12) GOTO 3080
3070 GOSUB 4000
3080 RETURN
4000 REM EDIT SUBROUTINE
4010 K=J
4020 PRINT
4025 J=0
4028 PRINT"CHANGE TYPE CODE TO ZZZZ FOR DELETING"
4030 INPUT"ENTER # OF ITEM YOU WISH TO EDIT,0 IF NONE";J
4035 IF J=0 THEN J=K:RETURN
4040 CLS:PRINT"   ";F$(2):PRINT
4050 PRINT"   ";:GOSUB 6100
4060 PRINT:GOSUB 6000
4070 CLS:PRINT"   ";F$(2)
4080 FOR J=INT(K/12)*12+1 TO K:PRINT USING "## ";J;:GOSUB 6100:NEXT
4090 GOTO 4020
5000 REM LIST FILE WITH ANALYSIS
5005 INPUT"IS A LINE PRINTER TO BE USED(Y/N)";Z2$:IF Z2$<>"Y" AND Z2$<>"N" THEN GOSUB 10000:GOTO 5005
5010 CLS:PRINT"           LIST  MENU":PRINT
5020 PRINT"1. COMPLETE LIST AS ON FILE
5030 PRINT"2. LIST BY TYPE
5050 PRINT"3. END LIST PROGRAM
5060 PRINT:INPUT"ENTER APPROPRIATE CHOICE";Z9
5065 IF Z9=3 THEN RETURN
5070 ON Z9 GOSUB 5200,5300
5080 GOTO 5010
5100 RETURN
5200 REM COMPLETE LIST
5205 CLS:IF Z2$="Y" THEN PRINT"PUT PAPER INTO PRINTER":GOSUB 10100
5210 PRINT F$(2):IF Z2$="Y" THEN LPRINT TAB(20);"COMPLETE LIST":LPRINT F$(5)
5215 V(1)=0:V(2)=0:V(3)=0:V(4)=0
5220 FOR J = 1 TO NI
5230 GOSUB 6100:GOSUB 6300:REM 1 RECORD PRINTED
5233 V(1)=V(1)+B(J,1):REM TOTAL FACE AMOUNT
5236 V(2)=V(2)+B(J,2):REM TOTAL PREMIUM AMOUNT
5240 IF J/12 = INT(J/12) THEN PRINT:GOSUB 10100:CLS:PRINT F$(2)
5250 NEXT J
5260 PRINT:GOSUB 10100
5265 PRINT USING "TOTAL FACE VALUE AMOUNT : $$#####.##";V(1)
5266 PRINT USING "TOTAL PREMIUM AMOUNT    : $$#####.##";V(2)
5268 IF Z2$<>"Y" THEN GOTO 5280
5271 LPRINT " ":LPRINT " "
5273 LPRINT USING "TOTAL FACE VALUE AMOUNT : $$#####.##";V(1)
5276 LPRINT USING "TOTAL PREMIUM AMOUNT    : $$#####.##";V(2)
5280 PRINT:GOSUB 10100:RETURN
5300 REM LIST TYPE
5305 CLS:INPUT"ENTER TYPE DESIRED";RM$
5310 V(1)=0:V(2)=0:V(3)=0:V(4)=0
5315 CLS:PRINT @ 398,"******* COMPUTING *******"
5320 FOR J=1 TO NI
5325 IF RM$<>A$(J,1) THEN GOTO 5390
5330 V(1)=V(1)+B(J,1):REM TOTAL FACE AMOUNT
5340 V(2)=V(2)+B(J,2):REM TOTAL PREMIUM AMOUNT
5390 NEXT J
5400 CLS:PRINT F$(2):IF Z2$="Y" THEN LPRINT TAB(20); "LIST OF TYPE ";RM$:LPRINT F$(5)
5405 JJ=0
5410 FOR J=1 TO NI
5415 IF RM$<>A$(J,1) THEN GOTO 5450
5417 JJ=JJ+1
5420 GOSUB 6100
5430 GOSUB 6300
5440 IF JJ/12=INT(JJ/12) THEN GOSUB 10100:CLS:PRINT F$(2):PRINT F$(6)
5450 NEXT J
5460 PRINT:GOSUB 10100
5470 PRINT
5480 PRINT USING "TOTAL FACE VALUE AMOUNT : $$#####.##";V(1)
5485 PRINT USING "TOTAL PREMIUM AMOUNT    : $$#####.##";V(2)
5500 IF Z2$<>"Y" THEN GOTO 5550
5505 LPRINT " ":LPRINT " "
5510 LPRINT USING "TOTAL FACE VALUE AMOUNT : $$#####.##";V(1)
5515 LPRINT USING "TOTAL PREMIUM AMOUNT    : $$#####.##";V(2)
5530 LPRINT:LPRINT
5550 PRINT:GOSUB 10100:RETURN
6000 REM SBR FOR INPUTTING DATA ON 1 PURCHASE
6005 F$(1)="%                        %"
6010 PRINT USING F$(1);A$(J,1),:INPUT"TYPE INSUR.      ";A$(J,1)
6015 PRINT USING F$(1);A$(J,2),:INPUT"POL. DESCRIPTION ";A$(J,2)
6020 PRINT USING F$(1);A$(J,3),:INPUT"DATE EXPIRES     ";A$(J,3)
6023 PRINT USING F$(1);A$(J,4),:INPUT"COMPANY WRITING  ";A$(J,4)
6025 PRINT USING F$(1);A$(J,5),:INPUT"UNDERWRITER      ";A$(J,5)
6030 PRINT USING F$(1);A$(J,6),:INPUT"POLICY NUMBER    ";A$(J,6)
6035 F$(1)=" #########.##                "
6040 PRINT USING F$(1);B(J,1),:INPUT"FACE AMOUNT    ";B(J,1)
6050 PRINT USING F$(1);B(J,2),:INPUT"ANNUAL PREMIUM ";B(J,2)
6099 RETURN
6100 REM PRINT 1 LINE OF PORTFOLIO
6110 PRINT USING F$(4);A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2)
6120 RETURN
6300 REM PRINT 1 LINE OF PORTFOLIO ON PRINTER
6310 IF Z2$<>"Y" THEN RETURN
6320 LPRINT USING F$(7);A$(J,1),A$(J,2),A$(J,3),A$(J,4),A$(J,5),A$(J,6),B(J,1),B(J,2)
6330 RETURN
7000 REM DELETE SBR COMPUTATION
7005 K=1:REM K=NO. OF RECORDS NOT DELETED
7010 FOR J=1 TO NI
7020 IF A$(J,1)="ZZZZ" GOTO 7090
7030 REM DO NOT DELETE RECORD
7040 FOR J6=1 TO 6:AT$(K,J6)=A$(J,J6):NEXT
7050 FOR J6=1 TO 3:BT(K,J6)=B(J,J6):NEXT
7060 K=K+1:GOTO 7090
7090 NEXT J
7100 K=K-1:NI=K
7110 FOR J=1 TO NI
7120 FOR J6=1 TO 6:A$(J,J6)=AT$(J,J6):NEXT
7130 FOR J6=1 TO 3:B(J,J6)=BT(J,J6):NEXT
7140 NEXT J
7150 RETURN
9000 REM FORMATTING VARIABLES
9020 F$(2)="TYPE  DESCRIPT  EXPIRES  CO.  UNDWRT   POL  #    AMT.    PREM"
9030 F$(4)="%  % %       % %      %  % %  %   %  %        % ####### #####"
9040 F$(5)="TYPE  DESCRIPTION    EXPIRES   COMP.   UNDWRT   POLICY  #  FACE AMT.   PREMIUM"
9060 F$(7)="%  %  %          %  %      %   %  %    %   %  %         %  #######     ########"
9099 RETURN
10000 REM INPUT ERROR SBR
10010 PRINT"INPUT ERROR! TRY AGAIN!":FOR Z9=1 TO 300:NEXT Z9
10020 RETURN
10100 INPUT"PRESS ENTER TO CONTINUE";Z9:RETURN
10200 REM Y,N,A SBR
10205 Z9$=" "
10210 INPUT"ENTER Y IF OK,N IF ERROR,A TO ABORT";Z9$
10220 IF Z9$<>"Y" AND Z9$<>"N" AND Z9$<>"A" THEN GOSUB 10000:GOTO 10205
10230 RETURN
10300 REM Y,N SBR
10305 Z9$=" "
10310 INPUT"ENTER Y IF OK, N IF ERROR";Z9$
10320 IF Z9$<>"Y" AND Z9$<>"N" THEN GOSUB 10000:GOTO 10305
10330 RETURN
10400 REM MORE ENTRY? SBR
10405 Z9$=" "
10410 INPUT"DO YOU DESIRE MORE ENTRIES(Y/N)";Z9$
10420 IF Z9$<>"Y" AND Z9$<>"N" THEN GOSUB 10000:GOTO 10405
10430 RETURN
10500 REM ONLY Y/N SBR
10510 IF Z9$<>"Y" AND Z9$<>"N" THEN GOSUB 10000
10520 RETURN
11000 REM ELIMINATES TRAILING BLANKS OF VARIABLE Z8$
11010 IF RIGHT$(Z8$,1)=" " THEN Z8$=LEFT$(Z8$,LEN(Z8$)-1):GOTO 11010
11020 RETURN
