80 PRINT TAB( 3)"* UNIV. DATA MANAGEMENT SYSTEM 4.0 *": PRINT TAB( 6)"COPYRIGHT 1980 BY W.L.PASSAUER": RETURN
100 D1 = PEEK(864):P$ = CHR$( PEEK(865)):P1$ = CHR$( PEEK(866)):S$ = STR$( PEEK(867)):I = PEEK(868): FOR X = 869 TO I +868:N$ = N$ + CHR$( PEEK(X)): NEXT
120 RF$ = D$ +"READ" +N$ +",R":OF$ = D$ +"OPEN" +N$ +",L":CL$ = D$ +"CLOSE": IF D1 = 1 THEN HOME : PRINT CHR$(7): VTAB 12: HTAB 4: PRINT "LOAD ";: INVERSE : PRINT "DATA DISK";: NORMAL : PRINT " THEN PRESS 'RTN'";: GET Z$
140 PRINT : PRINT D$"OPEN"N$".V,D"D1: PRINT D$"READ"N$".V": INPUT NC,RC,RR: DIM CL(NC): FOR X = 1 TO NC: INPUT CL(X): NEXT
180 LL = (CL(NC) +NC): PRINT D$"OPEN"N$",L"LL",D"D1: DIM B$(40,NC),BC(RR),A$(NC),S2(NC),S$(RC),H$(NC),CL%(NC),BB(RC),SE(20),C(20,20),DT$(20,20),SL(NC),S1(NC)
190 FOR X = 1 TO NC:B1 = CL(X -1): PRINT D$"READ"N$",R"0",B"B1: CALL 783:H$(X) = MID$ (TE$,1): NEXT : PRINT D$"CLOSE": FOR X = 1 TO NC:CL%(X) = CL(X) -CL(X -1) -1: NEXT : GOSUB 40
220 PRINT CHR$(7);: GOTO 5000
270 ONERR GOTO 295
280 PRINT : PRINT OF$LL",D"D1: FOR I = 1 TO RC:B1 = CL(C -1): PRINT RF$I",B"B1: CALL 783:S$(I) = MID$ (TE$,1): NEXT : PRINT CL$: RETURN
290 ONERR GOTO 293
292 PRINT OF$LL",D"D1: FOR I = 1 TO X1:B1 = CL(C(X3,L) -1): PRINT RF$BB(I)",B"B1: CALL 783:S$(I) = MID$ (TE$,1): NEXT : PRINT CL$: RETURN
293 I = BB(I)
295 POKE 216,0: PRINT CHR$(7): HOME : VTAB 12: PRINT "DISK ERROR-RECORD ";: INVERSE : PRINT I;: NORMAL : PRINT " MAY BE BAD": PRINT "PRESS 'RTN'";: GET Z$: GOTO 8357
390 PRINT D$"OPEN DATA FILES,D1": PRINT D$"READ DATA FILES": INPUT NR: FOR J = 1 TO NR: INPUT R$(J): NEXT : PRINT D$"CLOSE":R$(NR +1) = R$: PRINT D$"OPEN DATA FILES": PRINT D$"WRITE DATA FILES": PRINT NR +1: FOR J = 1 TO NR +1: PRINT R$(J): NEXT : PRINT D$"CLOSE": GOTO 410
400 CALL 1013: PRINT D$"OPEN DATA FILES": PRINT D$"WRITE DATA FILES": PRINT 1: PRINT R$: PRINT D$"CLOSE"
410 POKE 216,0: RETURN
700 FOR I = 1013 TO 1022: READ PP: POKE I,PP: NEXT : RETURN : DATA 104,168,104,166,223,154,72,152,72,96
800 B$ = "": PRINT : FOR I = 1 TO L: PRINT "_";: NEXT : VTAB ( PEEK(37) +2 -(L/39.9)): HTAB 1
810 FOR I = 1 TO L +1
820 GET E$
823 IF E$ = CHR$(10) THEN E$ = CHR$(92)
824 IF E$ = CHR$(11) THEN E$ = CHR$(91)
825 IF E$ = CHR$(12) THEN E$ = CHR$(95)
830 IF E$ = CHR$(21) THEN 820
840 IF E$ = CHR$(8) THEN GOSUB 890: GOTO 820
850 IF E$ = CHR$(13) THEN PRINT E$;: RETURN
860 PRINT E$;:B$ = B$ +E$: NEXT
870 IF RIGHT$(B$,1) < > CHR$(13) THEN GOSUB 940: GOTO 800
880 RETURN
890 IF I < = 1 THEN RETURN
900 PRINT CHR$(8);"_"; CHR$(8);
910 I = I -1
920 IF I = <1 THEN I = 1:B$ = "": RETURN
930 B$ = LEFT$(B$, LEN(B$) -1): RETURN
940 PRINT CHR$(7): INVERSE : HTAB 10: PRINT "ENTRY IS TOO LONG": NORMAL : RETURN
950 SK = INT(CL%(C(X5,Y))/40): FOR X = 1 TO SK: PRINT : NEXT : RETURN
960 HOME : VTAB 12: PRINT CHR$(7);: PRINT "LOAD <DISKETTE B> AN INITIALIZED 'NEW FILE' DISKETTE INTO DRIVE #1 AND": PRINT "PRESS'RTN' ";: GET Z$: HOME : RETURN
5020 PRINT : PRINT "PLEASE LABEL YOUR DISKETTES AS NEEDED:": PRINT : HTAB 7: PRINT "A- EXISTING FILE IN MEMORY": PRINT : HTAB 7: PRINT "B- NEW FILE": PRINT : HTAB 7: PRINT "C- APPEND TO FILE": PRINT : HTAB 11: PRINT "THEN PRESS 'RTN' ";: GET Z$: HOME
5030 IF ASC(Z$) = 17 THEN TEXT : GOTO 8380
5040 HOME : VTAB 9: HTAB 14: PRINT "- TRANSFER -": PRINT : HTAB 7: PRINT "1-RECORDS MATCHING 'ENTRY/S'": HTAB 7: PRINT "2-FROM/TO RECORD NUMBERS": HTAB 7: PRINT "3-SELECTED RECORDS": PRINT : HTAB 13: INPUT "WHICH (1-3): ";E2: IF E2 >3 THEN PRINT CHR$(7): GOTO 50
5060 IF E2 = 1 THEN 5220
5080 IF E2 = 2 THEN 5180
5100 POKE 34,2: HOME : HTAB 8: PRINT "ENTER <0> WHEN FINISHED": GOSUB 360: POKE 34,4: FOR X6 = 1 TO RR
5120 PRINT "ENTER RECORD # "X6" (1-"RC") ";: INPUT "";BC(X6): IF BC(X6) >RC THEN PRINT CHR$(7); GOSUB 340: GOTO 5120
5140 IF BC(X6) = 0 THEN X6 = X6 -1: POKE 34,2: GOTO 5220
5160 NEXT
5180 HOME : PRINT : PRINT "TRANSFER FROM RECORD # (1-"RC") ";: INPUT "";A: IF A >RC THEN PRINT CHR$(7): GOTO 5180
5200 PRINT : PRINT "TO RECORD # ("A"-"RC") ";: INPUT "";B: IF B <A OR B >RC THEN PRINT CHR$(7);: GOSUB 345: GOTO 5200
5210 E = 0: FOR X6 = A TO B:E = E +1:BC(E) = X6: NEXT :X6 = B -A +1
5220 HOME : VTAB 9: HTAB 13: PRINT "- SELECT ONE -": PRINT : HTAB 7: PRINT "1- APPEND RECORDS TO A FILE": HTAB 7: PRINT "2- CREATE A NEW FILE": PRINT : HTAB 13: INPUT "WHICH (1-2): ";E1: IF E1 >2 THEN PRINT CHR$(7): GOSUB 340: GOTO 5220
5221 IF E1 = 2 THEN 5240
5222 HOME : PRINT CHR$(7): VTAB 11: PRINT "PLACE <DISKETTE C> 'APPEND TO'": PRINT "INTO DRIVE #1 AND PRESS 'RTN' ";: GET Z$
5224 ONERR GOTO 5295
5226 HOME : PRINT : PRINT D$"OPEN DATA FILES,D1": PRINT D$"READ DATA FILES": INPUT NR: FOR J = 1 TO NR: INPUT R$(J): NEXT : PRINT CL$: PRINT : HTAB 7: PRINT "-- DATA FILES AVAILABLE --": PRINT : FOR I = 1 TO NR: PRINT I" "R$(I): NEXT : PRINT
5228 POKE 216,0: PRINT "APPEND TO WHICH FILE: (1-"NR") ";: INPUT "";Z1$:Z = VAL(Z1$): IF Z <1 OR Z >NR THEN PRINT CHR$(7);: GOSUB 340: GOTO 5228
5230 IF E1 = 1 THEN N1$ = R$(Z): GOTO 5250
5240 PRINT : PRINT "ENTER <DISKETTE B> 'NEW FILE' NAME (28) ":L = 28: GOSUB 800:N1$ = B$: IF N1$ = "" THEN PRINT CHR$(7);: GOSUB 345: GOTO 5240
5250 IF E1 = 2 THEN 8000
5270 PRINT : PRINT D$"OPEN"N1$".V,D1": PRINT D$"READ"N1$".V": INPUT A1,A2,A3: DIM CM(A1),CM%(A1): FOR X = 1 TO A1: INPUT CM(X):CM%(X) = CM(X) -CM(X -1) -1: NEXT : PRINT CL$:LA = CM(A1) +A1: PRINT
5280 POKE 216,0: IF E2 < >1 THEN 8002
5290 GOTO 8000
5295 PRINT CHR$(7): PRINT "FILE NOT FOUND! PRESS 'RTN'";: GET Z$: GOTO 5222
5320 HTAB 16: INPUT "WHICH: ";W9$: IF W9$ < >"" THEN IF ASC(W9$) = 17 THEN 8357
5340 IF W9$ <"1" OR W9$ >"2" THEN PRINT CHR$(7);: GOSUB 340: GOTO 5320
5360 IF W9$ = "2" THEN PRINT : GOTO 5420
5380 PRINT
5400 INPUT "REGULAR OR INTERNAL SEARCH (R/I) ? ";Z2$: IF Z2$ < >"R" AND Z2$ < >"I" THEN PRINT CHR$(7);: GOSUB 340: GOTO 5400
5420 TEXT : HOME : VTAB 7: HTAB 10: PRINT "* WRITE-OUT ITEMS *": PRINT : HTAB 9: PRINT "1- EQUAL TO ENTRY": HTAB 9: PRINT "2- NOT EQUAL TO ENTRY": PRINT
5440 HTAB 16: INPUT "WHICH: ";Z3$: IF Z3$ <"1" OR Z3$ >"2" THEN PRINT CHR$(7);: GOSUB 340: GOTO 5440
5460 FOR X5 = 1 TO 20: HOME : IF Z3$ = "1" THEN HTAB 3: PRINT "ENTER <0> FOR LEVELS WHEN FINISHED": GOSUB 360: HTAB 6: PRINT "SEARCH >"X5"< OF >20< POSSIBLE": GOSUB 360: GOTO 5500
5480 INVERSE : HTAB 9: PRINT "ONLY ONE SEARCH ALLOWED": NORMAL
5500 IF NC >19 THEN 5580
5520 VTAB 6: PRINT "SEARCH HOW MANY LEVELS (0-"NC") ";: INPUT SE(X5): IF SE(X5) <0 OR SE(X5) >NC THEN PRINT CHR$(7): GOTO 5520
5540 IF SE(X5) = 0 THEN X5 = X5 -1: HOME : GOTO 5780
5560 IF NC <20 THEN 5620
5580 VTAB 6: INPUT "SEARCH HOW MANY LEVELS (0-20) ? ";SE(X5): IF SE(X5) <0 OR SE(X5) >20 THEN PRINT CHR$(7): GOTO 5580
5600 IF SE(X5) = 0 THEN X5 = X5 -1: GOTO 5800
5620 HOME : GOSUB 350: GOSUB 360: HTAB 11: PRINT "SEARCHING "SE(X5)" LEVEL/S": GOSUB 360: FOR Y = SA TO SE(X5)
5640 PRINT "FOR LEVEL# "Y" SEARCH FIELD #: ";: INPUT C(X5,Y): IF C(X5,Y) <1 OR C(X5,Y) >NC THEN PRINT CHR$(7);: GOSUB 340: GOTO 5640
5680 INPUT "ALL CORRECT (Y/N) ? ";Z$: IF Z$ < >"N" AND Z$ < >"Y" THEN PRINT CHR$(7);: GOSUB 340: GOTO 5680
5700 PRINT
5720 IF Z$ = "N" THEN PRINT "RESTART AT LEVEL # (1-"SE(X5)"): ";: INPUT SA: IF SA <1 OR SA >SE(X5) THEN PRINT CHR$(7);: GOSUB 340: GOTO 5720
5740 IF Z$ = "N" THEN HOME : PRINT : GOTO 5620
5760 IF Z3$ = "1" THEN HOME : NEXT X5
5780 IF E1 = 2 AND D1 = 2 THEN GOSUB 960
5800 FOR X3 = 1 TO X5:X2 = RC:X1 = 0: VTAB 8: HTAB 9: PRINT "SEARCHING FOR ENTRY # "X3: FOR L = 1 TO SE(X3): GOSUB 370: IF L = 1 THEN C = C(X3,L): GOSUB 270: GOTO 5860
5820 IF X1 <1 THEN HOME : PRINT CHR$(7): VTAB 12: PRINT "NO MATCHES FOUND PRESS 'RTN'";: GET Z$: GOTO 8357
5840 GOSUB 290:X2 = X1:X6 = X6 -X1:X1 = 00
5860 VTAB 12: PRINT TAB( 9)"> SEARCHING LEVEL "L" <":PA = LEN(DT$(X3,L)): IF PA <1 THEN PA = 1
5880 FOR RS = 1 TO X2: IF Z2$ = "I" THEN 6300
5900 IF W9$ = "2" THEN 6100
5920 IF Z3$ = "2" THEN 6020
5940 IF LEFT$(S$(RS),PA) = DT$(X3,L) THEN X1 = X1 +1:X6 = X6 +1: GOTO 5980
5960 GOTO 6440
5980 IF L <2 THEN BB(X1) = RS:BC(X6) = RS: GOTO 6440
6000 BB(X1) = BB(RS):BC(X6) = BB(RS): GOTO 6440
6020 IF LEFT$(S$(RS),PA) < >DT$(X3,L) THEN X1 = X1 +1:X6 = X6 +1: GOTO 6060
6040 GOTO 6440
6060 IF L <2 THEN BB(X1) = RS:BC(X6) = RS: GOTO 6440
6080 BB(X1) = BB(RS):BC(X6) = BB(RS): GOTO 6440
6100 IF Z3$ = "2" THEN 6200
6120 IF S$(RS) = DT$(X3,L) THEN X1 = X1 +1:X6 = X6 +1: GOTO 6160
6140 GOTO 6440
6160 IF L <2 THEN BB(X1) = RS:BC(X6) = RS: GOTO 6440
6180 BB(X1) = BB(RS):BC(X6) = BB(RS): GOTO 6440
6200 IF S$(RS) < >DT$(X3,L) THEN X1 = X1 +1:X6 = X6 +1: GOTO 6240
6220 GOTO 6440
6240 IF L <2 THEN BB(X1) = RS:BC(X6) = RS: GOTO 6440
6260 BB(X1) = BB(RS):BC(X6) = BB(RS): GOTO 6440
6280 GOTO 8130
6300 F = LEN(S$(RS)): FOR X4 = 1 TO F: IF Z3$ = "2" THEN 6400
6320 IF MID$ (S$(RS),X4,PA) = DT$(X3,L) THEN 6360
6340 NEXT X4: IF Z3$ = "1" THEN 6440
6360 X1 = X1 +1:X6 = X6 +1: IF L <2 THEN BB(X1) = RS:BC(X6) = RS: GOTO 6440
6380 BB(X1) = BB(RS):BC(X6) = BB(RS): GOTO 6440
6400 IF MID$ (S$(RS),X4,PA) = DT$(X3,L) THEN 6440
6420 GOTO 6340
6440 NEXT RS: NEXT L
6460 NEXT X3: IF X6 <1 THEN HOME : GOTO 8355
6480 HOME : GOTO 8130
8000 CALL 37896: TEXT : HOME : HTAB 8: PRINT "- SET-UP TRANSFER FILE -": GOSUB 360: POKE 34,2: PRINT
8002 E = 0:C = 0:D = -1:Z = 0: HOME : IF E1 = 2 THEN HTAB 9: PRINT "ENTER <0> WHEN FINISHED": GOSUB 360: POKE 34,4:A1 = NC
8010 GOSUB 350: PRINT : FOR V = 1 TO A1
8020 PRINT "TRANSFER FIELD # ('RTN'=ALL/1-"NC") ";: INPUT "";S1$
8030 IF E1 = 2 OR (NC = A1 AND E1 = 1) THEN IF S1$ = "" THEN FOR V = 1 TO NC:S1$ = STR$(V): GOTO 8060
8040 IF S1$ = "0" THEN PRINT : GOTO 8070
8050 IF S1$ = "" OR VAL(S1$) <0 OR VAL(S1$) >NC THEN PRINT CHR$(7);: GOSUB 340: GOTO 8020
8060 IF E1 = 2 THEN S1(V) = VAL(S1$):SL(V) = SL(V -1) +(CL(S1(V)) -CL(S1(V) -1)):A$(V) = H$(S1(V)): NEXT
8065 IF E1 = 1 THEN S2(V) = VAL(S1$):S1(V) = S2(V): NEXT : PRINT
8070 EN = V -1
8080 PRINT : PRINT :EM = EN:LB = SL(EM) +EM: TEXT
8082 HOME : FOR X = 1 TO EN: PRINT TAB( 4)X;"- ("CL%(S1(X))") ";: HTAB 14: PRINT H$(S1(X)): NEXT
8083 PRINT : INPUT "ENTER THE LENGTH OF THE LONGEST FIELD YOU WILL SORT OR SEARCH (>9)? ";N2: IF N2 <10 THEN PRINT CHR$(7): GOTO 8082
8084 N2 = N2 +12:RR = INT(28700/N2):L1% = INT(252960/(N2 -12)): IF L1% <RR THEN RR = L1%
8090 IF E2 = 1 THEN 5300
8130 IF E1 = 1 THEN IF (X6 +A2) >A3 THEN TEXT : HOME : PRINT CHR$(7): VTAB 12: PRINT "APPENDING TOO MANY RECORDS-PRESS 'RTN'";: GET Z$: GOTO 8357