1 CLS:PRINT "THIS PROGRAM IS A SIMPLE STOCK PORTFOLIO PROGRAM. IT WILL  
2 PRINT " PERMIT THE USER TO STORE DATA ABOUT HIS PORTFOLIO OF SECURIT-  
3 PRINT "IES AS WELL AS GIVE A PROFIT ANALYSIS OF THE PORTFOLIO.  
4 PRINT "FOR EACH SECURITY WE STORE STOCK TICKER CODE,COMPANY NAME  
5 PRINT "DATE OF PURCHASE, # UNITS PURCHASED, PURCHASE PR/UNIT,  
6 PRINT "PRESENT PR/UNIT, YEARLY DIVIDENDS/UNIT.  
7 PRINT :PRINT " THE ANALYSIS COMPUTES SUCH ELEMENTS AS PORTFOLIO AT COST.  
8 PRINT "PRESENT VALUE OF PORTFOLIO, PRESENT YIELD, ETC.  
9 PRINT :INPUT "PRESS ENTER TO BEGIN";Z9$  
19 CLEAR  1000  
20 DEFDBL  B,V  
30 DIM  A$(70,4),B(70,8)  
35 DIM  AT$(70,4),BT(70,8)  
40 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 FILE AND PROFIT ANALYSIS  
580 PRINT " 8.ROUTINE ACTUALLY DELETING RECORD FROM FILE  
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):PRINT F$(3):GOSUB 6100:REM PRINT OUT 1 RECORD  
1040 GOSUB  10200:IF  Z9$="N" THEN 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
1090 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),B(J,1),B(J,2),B(J,3),B(J,4):NEXT   
2040 RETURN   
2100 REM WRITE OUT FILE ONTO TAPE  
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),B(J,1),B(J,2),B(J,3),B(J,4):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  
2230 OPEN "I",1,"PORTFOLIO"  
2240 INPUT # 1,NI  
2250 FOR  J=1  TO  NI:INPUT # 1,A$(J,1),A$(J,2),A$(J,3),B(J,1),B(J,2),B(J,3),B(J,4):NEXT   
2260 CLOSE # 1  
2270 RETURN   
2290 PRINT  "FILE DOES NOT EXIST":GOSUB  10100:RETURN   
2300 REM WRITE FILE OUT TO DISK  
2310 PRINT :PRINT "PUT DATA DISK IN DISK DRIVE":GOSUB  10100  
2320 OPEN "O",1,"PORTFOLIO"  
2330 WRITE # 1,NI  
2340 FOR  J=1  TO  NI  
2350 WRITE # 1,A$(J,1),A$(J,2),A$(J,3),B(J,1),B(J,2),B(J,3),B(J,4)
2360 NEXT  J  
2370 CLOSE # 1  
2380 RETURN   
3000 REM EDIT FILE  
3010 CLS:PRINT "   ";F$(2):PRINT "   ";F$(3)  
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) THEN GOTO  3080  
3070 GOSUB  4000  
3080 RETURN   
4000 REM EDIT SUBROUTINE  
4010 K=J  
4020 PRINT   
4025 J=0  
4028 PRINT "CHANGE STOCK TICKER 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 "   ";F$(3):PRINT   
4050 PRINT "   ";:GOSUB  6100  
4060 PRINT :GOSUB  6000  
4070 CLS:PRINT "   ";F$(2):PRINT "   ";F$(3)  
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 WITH PAPER PROFIT, YIELD & PORTFOLIO VALUE  
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):PRINT  F$(3):IF  Z2$="Y" THEN LPRINT  F$(2):LPRINT  F$(3)  
5220 FOR  J = 1  TO  NI  
5230 GOSUB 6100:GOSUB 6300:REM 1 RECORD PRINTED  
5240 IF  J/12 = INT(J/12) THEN PRINT :GOSUB  10100:CLS:PRINT  F$(2):PRINT  F$(3)  
5250 NEXT  J  
5260 PRINT :GOSUB  10100  
5270 RETURN   
5300 REM PORTFOLIO ANALYSIS  
5310 V(1)=0:V(2)=0:V(3)=0:V(4)=0  
5315 CLS:PRINT  @  398,"******* COMPUTING *******"  
5320 FOR  J=1  TO  NI  
5330 V(1)=V(1)+B(J,1)*B(J,2):REM PORTFOLIO AT COST  
5340 V(2)=V(2)+B(J,1)*B(J,3):REM PORTFOLIO VALUE NOW  
5350 V(3)=V(3)+B(J,1)*B(J,4):REM TOTAL DIVIDENDS  
5360 B(J,5)=B(J,4)/B(J,3)*100:REM PRESENT YIELD  
5370 B(J,6)=B(J,3)/B(J,2)*100-100:REM % PROFIT  
5380 B(J,7)=B(J,1)*B(J,3):REM PRESENT VALUE   
5390 NEXT  J  
5400 CLS:PRINT  F$(5):PRINT  F$(6):IF  Z2$="Y" THEN LPRINT  F$(5):LPRINT  F$(6)  
5410 FOR  J=1 TO NI  
5420 PRINT USING  F$(7);A$(J,1),A$(J,3),B(J,2),B(J,3),B(J,5),B(J,7),B(J,6)  
5430 IF  Z2$="Y" THEN LPRINT  USING  F$(7);A$(J,1),A$(J,3),B(J,2),B(J,3),B(J,5),B(J,7),B(J,6)  
5440 IF  J/12=INT(J/12) THEN GOSUB  10100:CLS:PRINT  F$(5):PRINT  F$(6)  
5450 NEXT  J  
5460 PRINT :GOSUB  10100  
5470 PRINT   
5480 PRINT USING  "PORTFOLIO VALUE AT COST : $$#####.##";V(1)  
5485 PRINT USING  "PRESENT PORTFOLIO VALUE : $$#####.##";V(2)  
5487 PRINT USING  "DOLLAR PAPER PROFIT     : $$#####.##";V(2)-V(1)  
5490 PRINT USING  "TOTAL DIVIDENDS PER YEAR: $$#####.##";V(3)  
5495 PRINT USING  "DIVIDEND YIELD          :    ####.##";V(3)/V(2)  
5500 IF  Z2$<>"Y" THEN GOTO  5550  
5510 LPRINT  USING "PORTFOLIO VALUE AT COST : $$#####.##";V(1)  
5515 LPRINT  USING "PRESENT PORTFOLIO VALUE : $$#####.##";V(2)  
5517 LPRINT  USING "DOLLAR PAPER PROFIT     : $$#####.##";V(2)-V(1)  
5520 LPRINT  USING "TOTAL DIVIDENDS PER YEAR: $$#####.##";V(3)  
5525 LPRINT  USING "DIVIDEND YIELD          :     ###.##";V(3)/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 "STOCK TICKER CODE";A$(J,1)  
6020 PRINT USING F$(1);A$(J,2),:INPUT "COMPANY NAME     ";A$(J,2)  
6030 PRINT USING F$(1);A$(J,3),:INPUT "DATE OF PURCHASE ";A$(J,3)  
6035 F$(1)=" ######.##                "  
6040 PRINT USING F$(1);B(J,1),:INPUT "# UNITS PURCHASED";B(J,1)  
6050 PRINT USING F$(1);B(J,2),:INPUT "PURCHASE PR/UNIT ";B(J,2)  
6060 PRINT USING F$(1);B(J,3),:INPUT "PRESENT  PR/UNIT ";B(J,3)  
6070 PRINT USING F$(1);B(J,4),:INPUT "YEARLY  DIV/UNIT ";B(J,4)  
6099 RETURN   
6100 REM PRINT 1 LINE OF PORTFOLIO  
6110 PRINT USING  F$(4);A$(J,1),A$(J,2),A$(J,3),B(J,2),B(J,3),B(J,4),B(J,1)  
6120 RETURN   
6300 REM PRINT 1 LINE OF PORTFOLIO ON PRINTER  
6310 IF  Z2$<>"Y"  THEN  RETURN   
6320 LPRINT  USING  F$(4);A$(J,1),A$(J,2),A$(J,3),B(J,2),B(J,3),B(J,4),B(J,1)  
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" THEN GOTO  7090  
7030 REM DO NOT DELETE RECORD  
7040 FOR  J6=1 TO 4:AT$(K,J6)=A$(J,J6):NEXT   
7050 FOR  J6=1 TO 7: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 4:A$(J,J6)=AT$(J,J6):NEXT   
7130 FOR  J6=1 TO 7:B(J,J6)=BT(J,J6):NEXT   
7140 NEXT  J  
7150 RETURN   
9000 REM FORMATTING VARIABLES  
9020 F$(2)="TK    CORP. NAME    DATE   PURCH.    PRESENT  YEARLY   NO."  
9025 F$(3)="CODE               PURCH   PR/UNIT   PR/UNIT  DIV/UNIT UNITS"  
9030 F$(4)="%   % %         % %      % ####.##   ####.## ####.##  #####"  
9040 F$(5)=" TK    DATE      PURCH.   PRES.    YIELD    PRESENT  % PROFIT"  
9050 F$(6)="CODE  PURCH.    PR/UNIT  PR/UNIT     %       VALUE"  
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   

