rem ************************************************
rem *         STOCK PRICE DATABASE PROGRAM	   *
rem ************************************************
rem *	MAIN PROGRAM 2 - STKPRICE.BAS		   *
rem *   -----------------------------		   *
rem *	COPYRIGHT: Edward A. Valenzuela		   *
rem *	DATE: 	   February 5, 1983		   *
rem *	VERSION:   1.31				   *
rem ************************************************

COMMON OPTION%,entry%, nstk%,morestock$

rem ---------- functions used in program -------------------------------

%include scrnin
%include juldate%

n%=50
dim nshrs%(n%),namstk$(n%),xchng$(n%),equiv(n%)
dim purdate$(n%),totpurprice(n%),commission(n%)
dim incvalue(n%),pcntinc(n%),anyield(n%),key%(n%)
dim X$(N%),day%(n%),symbol$(n%)
DIM NEWPRICE(N%),OLDPRICE(N%),NEWVALUE(N%)
dim dividend(n%),YIELD(N%)
rem ... stock beta calculation arrays ...
m%=50
dim x(m%),y(m%),x0(m%),xr(m%),yr(m%),x%(m%),kode%(m%)

  entry% = 2
900 REM ...PRINT MAIN MENU...

if option% = 4 THEN GOTO 940
if option% = 5 then goto 950
GOTO 990

rem -----end of screen option menu-----

940 rem ...... performance summary ......
    rem ...... versus original purchase ......
gosub 7000
goto 900

950 rem ...... update weekly stock prices ......
gosub 5000
goto 900

990 rem ..... return to original menu .....

  drive$ = "A:"
  prog.name$ = "STKBASE"
  CHAIN DRIVE$ + PROG.NAME$

goto 999
rem ************************************************
rem *             SUBROUTINES                      *
rem ************************************************

%include stkupdat

%include stkprfm

%include stkfprnt

%include stkhist

%include qksort%

%include qksort$

rem *---------------- END STKPRICE ----------------*

rem ... jump vectors for reading and writing files

rem -----------------------------------------------

310 rem ... unit number 9
    READ #9; nshrs%(i%), namstk$(i%), symbol$(i%), xchng$(i%), purdate$(i%), \
             commission(i%), totpurprice(i%), key%(i%), dividend(i%)
    RETURN 

315 rem ... read nstk% records
    rem ... use i% for array element
    FOR i% = 1 to nstk%
      GOSUB 310
    NEXT i%
    RETURN

320 rem ... unit number 8
    READ #8; nstk%, newdate$, olddate$
    RETURN

325 rem ... use i% for array element
    READ #8; newprice(i%),oldprice(i%)
    RETURN

330 rem ... read nstk% records
    FOR i% = 1 to nstk%
      GOSUB 325
    NEXT i%
    RETURN

335 rem ... unit number 9
    PRINT #9; nshrs%(i%), namstk$(i%), symbol$(i%), xchng$(i%), purdate$(i%), \
              commission(i%), totpurprice(i%), key%(i%), dividend(i%)
    RETURN

340 rem ... print nstk% records
    rem ... use i% for array element
    FOR i% = 1 to nstk%
      GOSUB 335
    NEXT i%
    RETURN

345 rem ... unit number 8
    PRINT #8; nstk%, newdate$, olddate$
    RETURN

350 rem ... use i% for array element
    PRINT #8; newprice(i%), oldprice(i%)
    RETURN

355 rem ... print nstk% records
    FOR i% = 1 to nstk%
      GOSUB 350
    NEXT i%
    RETURN

999 end

rem ************** MAIN PROGRAM END ****************
