120 HOME : VTAB 2: HTAB 13: PRINT "NIBBLE INVESTOR"
130 HTAB 12: PRINT "PRICE FILE EDITOR"
140 HTAB 12: PRINT "BY GERHALD HANSEL": PRINT
150 PRINT "** COPYRIGHT 1985 BY MICROSPARC, INC. **": PRINT
160 VTAB 12
170 PRINT "THIS PROGRAM ALLOWS YOU TO EDIT"
180 PRINT "THE PRICE FILES CREATED BY THE INVESTOR.": PRINT
190 PRINT "THE INVESTOR IS A STOCK INVESTMENT"
200 PRINT "PROGRAM PRINTED IN NIBBLE MAGAZINE"
210 PRINT "VOLUME #4, ISSUE #2 AND"
220 PRINT "NIBBLE EXPRESS VOLUME IV.": PRINT
230 GOSUB 310
240 HOME : CLEAR :D$ = CHR$(4): REM CTRL-D
250 PRINT "CHOOSE ONE OF THE FOLLOWING:": PRINT : PRINT "1. SORT PRICE FILE BY DATE": PRINT : PRINT "2. DELETE DUPLICATES": PRINT " (DATA MUST BE SORTED FIRST.)": PRINT
260 PRINT "3. LIST ALL ENTRIES": PRINT : PRINT "4. ENTER DATA": PRINT
270 PRINT "5. DELETE ONE RECORD": PRINT " (FILE SHOULD BE LISTED AND": PRINT " EXAMINED FIRST.)": PRINT : PRINT "6. CHANGE NUMBER OF RECORDS": PRINT : PRINT "7. QUIT PROGRAM"
280 GET A$: PRINT :A = VAL(A$): IF A <1 OR A >7 THEN 240
290 HOME :X = FRE(0)
300 ON A GOTO 560,930,1270,1580,2000,2330,2500
310 HTAB 7: INPUT "PRESS <RETURN> TO CONTINUE.";A$: RETURN
320 PRINT "R# HI LOW CLOSE VOLUME M/ D/YR": RETURN
330 REM FILE NAME INPUT
340 HOME : PRINT "IF YOU NEED THE CATALOG, TYPE ? <RETURN>"
350 INPUT "FILE NAME ";NA$: IF NA$ = "" THEN 340
360 IF NA$ = "?" THEN PRINT D$;"CATALOG": GOSUB 310: GOTO 340
370 NL = ASC(NA$): IF NL > = 65 AND NL < = 90 OR NL > = 193 AND NL < = 218 THEN 390
380 PRINT "FILE NAME MUST BEGIN WITH A LETTER": PRINT : GOSUB 310: GOTO 340
390 PRINT D$;"VERIFY";NA$
400 RETURN
410 REM INPUT RECORD 0
420 PRINT D$;"OPEN";NA$;",L50
430 PRINT D$;"READ ";NA$;",R0"
440 INPUT U$:R = VAL(U$): RETURN
450 PRINT : PRINT "THERE ARE "R" RECORDS IN FILE "NA$".": PRINT : RETURN
460 REM INPUT RECORDS
470 FOR W = 1 TO R
480 PRINT D$;"READ";NA$;",R";W
490 FOR F = 1 TO 7: INPUT V$(F)
500 NEXT
510 NEXT W
520 PRINT D$;"CLOSE"
530 RETURN
540 REM FILE SORT ROUTINE
550 REM READ PRICE FILE DATA
560 GOSUB 340: GOSUB 420: GOSUB 450: DIM U$(120,7)
570 FOR W = 1 TO R
580 PRINT D$;"READ";NA$",R";W
590 FOR F = 1 TO 7: INPUT U$(W,F)
600 NEXT : NEXT W
610 PRINT D$;"CLOSE": PRINT
620 REM COMPARES DATES FOR SEQUENTIAL ORDER
630 FOR W = 1 TO R -1: PRINT ".";
640 IF VAL(U$(W +1,7)) < VAL(U$(W,7)) THEN 700: REM YEAR
650 IF VAL(U$(W +1,7)) > VAL(U$(W,7)) THEN 770: REM YEAR
660 IF VAL(U$(W +1,5)) < VAL(U$(W,5)) THEN 700: REM MONTH
670 IF VAL(U$(W +1,5)) > VAL(U$(W,5)) THEN 770: REM MONTH
680 IF VAL(U$(W +1,6)) < VAL(U$(W,6)) THEN 700: REM DAY
1020 IF VAL(U$(W,7)) < > VAL(U$(W +1,7)) THEN 1120: REM YEAR
1030 IF VAL(U$(W,5)) < > VAL(U$(W +1,5)) THEN 1120: REM MONTH
1040 IF VAL(U$(W,6)) < > VAL(U$(W +1,6)) THEN 1120: REM DAY
1050 REM DELETES RECORD AND MOVES OTHERS FORWARD ONE RECORD
1060 FOR X = W TO R -1
1070 FOR F = 1 TO 7
1080 U$(X,F) = U$(X +1,F)
1090 NEXT F: NEXT X
1100 DE = DE +1:R = R -1:W = R
1110 PRINT "ONE RECORD DELETED":SW = 1:SX = 1: REM DELETION FLAG
1120 NEXT W
1130 IF SX = 0 THEN PRINT "NO DUPLICATE RECORDS": GOSUB 310: GOTO 240
1140 IF SW = 1 THEN SW = 0: GOTO 1010
1150 REM STORES RECORDS
1160 PRINT : PRINT "STORING ";R;" RECORDS": PRINT : PRINT "NUMBER OF DUPLICATE RECORDS DELETED = "DE: PRINT
1170 PRINT D$;"OPEN";NA$;",L50"
1180 PRINT D$;"WRITE";NA$;",R0
1190 U$ = STR$(R): PRINT U$
1200 FOR W = 1 TO R
1210 PRINT D$;"WRITE";NA$;",R";W
1220 FOR F = 1 TO 7
1230 PRINT U$(W,F)
1240 NEXT F: NEXT W
1250 PRINT D$;"CLOSE";NA$: GOTO 240
1260 REM FILE LIST ROUTINE
1270 GOSUB 340
1280 PRINT "DO YOU WANT TO USE THE PRINTER? (Y/N)? ": GET A$: PRINT : IF A$ = "Y" THEN PRINT D$;"PR#1":PF = 1: GOTO 1300
1290 PF = 0: REM PRINTER FLAG
1300 GOSUB 420: GOSUB 450: GOSUB 320
1310 DIM W$(120,7)
1320 FOR W = 1 TO R
1330 PRINT D$;"READ";NA$;",R";W
1340 FOR F = 1 TO 7: INPUT V$(F):W$(W,F) = V$(F)
1350 NEXT : NEXT W
1360 PRINT D$;"CLOSE"
1370 FOR W = 1 TO R: FOR F = 1 TO 7
1380 U$(F) = W$(W,F)
1390 NEXT
1400 FOR F = 1 TO 3
1410 IF LEN(U$(F)) <7 THEN U$(F) = U$(F) +" ": GOTO 1410
1420 NEXT F
1430 REM FORMATS LISTING
1440 U$(4) = U$(4) +" "
1450 IF LEN(U$(4)) <8 THEN U$(4) = " " +U$(4): GOTO 1450
1460 IF LEN(U$(5)) <2 THEN U$(5) = " " +U$(5)
1470 IF LEN(U$(6)) <2 THEN U$(6) = " " +U$(6)
1480 U$(5) = U$(5) +" ":U$(6) = U$(6) +" "
1490 W$ = STR$(W) +" "
1500 IF LEN(W$) <3 THEN W$ = " " +W$
1510 LINE = LINE +1
1520 PRINT W$;: FOR F = 1 TO 7: PRINT U$(F);: NEXT F: IF PF THEN PRINT
1530 IF LINE = 20 AND PF = 0 AND W <R THEN LINE = 0: GOSUB 310: HOME : GOSUB 320
1540 NEXT W
1550 IF PF = 0 THEN GOSUB 310
1560 LINE = 0:PF = 0: PRINT D$;"PR#0": GOTO 240
1570 REM FILE INPUT
1580 PRINT "ARE YOU STARTING A NEW FILE (Y/N)": GET A$: PRINT : IF A$ = "Y" THEN PRINT "FILES MUST BE STARTED USING THE INVESTOR PROGRAM.": GOSUB 310: GOTO 240
1590 GOSUB 340: GOSUB 420: GOSUB 450
1600 PRINT D$;"CLOSE"NA$
1610 GOSUB 310
1620 FOR F = 1 TO 7
1630 READ B$(F)
1640 NEXT F
1650 HOME : PRINT : PRINT "INPUT DATA FOR RECORD # "R +1: PRINT
1660 REM INPUTS RECORD DATA
1670 PRINT : PRINT "IF YOU DO NOT WANT TO ENTER DATA,": PRINT : PRINT "TYPE E)ND FOR VOLUME.": PRINT
1690 A$ = LEFT$(U$(4),1): IF A$ = "E" THEN R$ = STR$(R): GOTO 1930
1700 FOR F = 1 TO 3
1710 PRINT B$(F),
1720 INPUT U$(F)
1730 NEXT F
1740 FOR F = 5 TO 7
1750 PRINT B$(F),
1760 INPUT U$(F)
1770 NEXT F
1780 PRINT "IF DATA IS CORRECT, PRESS RETURN.": PRINT : PRINT "TO RE-ENTER DATA, PRESS ANY OTHER KEY.": GET A$: PRINT : IF A$ = CHR$(13) THEN 1800
1790 VTAB 9: GOTO 1680
1800 R = R +1:R$ = STR$(R)
1810 REM STORES RECORD DATA
1820 PRINT D$;"OPEN";NA$;",L50"
1830 PRINT D$;"WRITE";NA$;",R";R
1840 FOR F = 1 TO 7
1850 PRINT U$(F)
1860 NEXT F
1870 PRINT D$;"CLOSE"NA$
1880 HOME : VTAB 10
1890 PRINT "MORE DATA PRESS <RETURN>": PRINT
1900 PRINT "FINISHED PRESS <SPACE BAR>"
1910 GET A$: PRINT : IF A$ < > CHR$(13) THEN 1950
1920 GOTO 1650
1930 REM STORES NUMBER OF RECORDS
1940 PRINT D$;"OPEN";NA$;",L50"
1950 PRINT D$;"WRITE";NA$;",R";0
1960 PRINT R$
1970 PRINT D$;"CLOSE";NA$: RESTORE : GOTO 240
1980 DATA HIGH,LOW,CLOSE,VOLUME,MONTH,DAY,YEAR
1990 REM DELETE ONE RECORD
2000 GOSUB 340: DIM U$(120,7)
2010 GOSUB 420: GOSUB 450
2020 PRINT D$;"CLOSE";NA$
2030 PRINT "WHICH RECORD# DO YOU WANT TO DELETE?": PRINT : PRINT "IF YOU DO NOT WANT TO DELETE ANY RECORD,": PRINT "PRESS <RETURN>."
2040 INPUT A$:A = VAL(A$)
2050 IF A$ = "" THEN 240
2060 IF A <1 THEN HOME : GOTO 2030
2070 IF A >R THEN PRINT "THERE ARE ONLY "R" RECORDS IN": PRINT : PRINT "THE "NA$" FILE.": PRINT : GOSUB 310: GOTO 2030
2080 IF A = R THEN 2200
2090 PRINT D$;"OPEN";NA$;",L50"
2100 FOR W = A TO R
2110 PRINT D$;"READ";NA$;",R";W
2120 FOR F = 1 TO 7: INPUT U$(W,F)
2130 NEXT F: NEXT W
2140 PRINT D$;"CLOSE"
2150 REM DELETES RECORD AND MOVES OTHERS FORWARD ONE RECORD
2160 FOR W = A TO R -1
2170 FOR F = 1 TO 7
2180 U$(W,F) = U$(W +1,F)
2190 NEXT F: NEXT W
2200 REM STORE RECORDS ON DISK
2210 U$ = STR$(R -1)
2220 PRINT D$;"OPEN";NA$;",L50"
2230 PRINT D$;"WRITE";NA$;",R0
2240 PRINT U$: IF A = R THEN 2300
2250 FOR W = A TO R -1
2260 PRINT D$;"WRITE";NA$;",R";W
2270 FOR F = 1 TO 7
2280 PRINT U$(W,F)
2290 NEXT F: NEXT W
2300 PRINT D$;"CLOSE";NA$:
2310 PRINT "THERE ARE NOW "R -1" RECORDS IN": PRINT : PRINT "THE "NA$" FILE.": PRINT : GOSUB 310: GOTO 240
2320 REM CHANGES NUMBER OF RECORDS
2330 GOSUB 340
2340 HOME : VTAB (4): PRINT "THIS SECTION ALLOWS YOU TO CHANGE THE": PRINT : PRINT "NUMBER OF RECORDS IN RECORD 0 OF": PRINT : PRINT "THE FILE "NA$".": PRINT