5 'PROGRAM TO UPDATE VALUE OF STOCK PORTFOLIO
6 'BY S.R. DUCKER, M.D.
7 'FINAL REVISION 11 MARCH 1982
10 PRINT
20 DIM T$(300)
30 PRINT CHR$(26)
40 Z=J-1
50 PRINT CHR$(26)
60 PRINT"TO UPDATE PORTFOLIO ENTER DATE AND QUOTATION"
70 PRINT "REMEMBER TO CHANGE QUOTATION TO DECIMAL."
80 LINE INPUT "DATE OF QUOTATION: ",D$
90 PRINT CHR$(26)
100 LPRINT"UPDATE AS OF ",D$
110 LPRINT
120 LPRINT"STOCK     VALUE    GAIN/LOSS  SHARES    QUOTE
130 LPRINT
140 X=7:D2=0
150 OPEN "I",1,"B:STOCKFL"
160 FOR I=1 TO 3 
170 INPUT #1,A$,B$,S,C,Q,D1
175	IF EOF(1) THEN 192  
180	T$=T$+A$
190 NEXT I
192 CLOSE
195 OPEN "I",1,"B:STOCKFL"
200 FOR I=1 TO 3 
210	INPUT #1,A$,B$,S,C,Q,D1
220     PRINT A$             
230     IF D2=0 THEN GOSUB 550
250	IF A$=MID$(T$,X,6) THEN GOSUB 420:D2=1:GOTO 280  
260	IF A$<>MID$(T$,X,6) THEN GOSUB 420: GOSUB 470:GOTO 270
270	D2=0
280     T1=T1+D1*S
290     X=X+6
300 NEXT I
310 CLOSE
320 LPRINT:LPRINT
330 LPRINT"INITIAL COST OF PORTFOLIO = ";"$";C2
340 LPRINT
350 LPRINT"TOTAL VALUE OF PORTFOLIO  = ";"$";W
360 LPRINT
370 LPRINT"GAIN OR LOSS ON PORTFOLIO = ";"$";W-C2
380 LPRINT
390 LPRINT"YEARLY DIVIDEND TOTAL     = ";"$";T1
400 END
410 ' CALCULATES VALUES TO PRINT
420 V=V+S*Q1
430 S1=S1+S
440 C1=C1+C
445 T1=T1 + D1
450 RETURN
460 ' PRINTS OUT UP-TO DATE DATA
470 G=V-C1:C2=C2+C1
480 LPRINT A$;TAB(8);:LPRINT USING "$$#####.##";V;
490 LPRINT TAB(20);:LPRINT USING "#####.##";G;
500 LPRINT TAB(30);S1;
510 LPRINT TAB(42);Q1
520 W=W+V:G1=G1+G
530 S1=0:V=0:G=0:C1=0
540 RETURN
550 ' GETS STOCK QUOTATION FOR DATE
560 IF D2=1 THEN 590
570 INPUT"TODAY'S QUOTE ON ABOVE ",Q1
580 PRINT CHR$(26)
590 RETURN
 ' GETS STOCK QUOTATION FOR DATE
560 IF D2=1 THEN 590
570 INPUT"TODAY'S QUOTE ON ABOVE ",Q1
580 PRINT CHR