home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
dbsalvag.zip
/
SEARCH.BAS
< prev
Wrap
BASIC Source File
|
1986-10-19
|
2KB
|
77 lines
100 rem: *** search.bas ***
110 rem:
111 rem: This program wil search a dBASE file for the
112 rem: existence of a user-supplied character string
113 rem: as the beginning characters of a record.
130 rem:
131 rem: Run Filter.bas before running this program to
132 rem: remove any ^Z's that might exist in the file
133 rem:
140 ON ERROR GOTO 640:ESC$=CHR$(27)
150 PRINT:PRINT
160 PRINT "String Search Utility"
180 print
190 Print "Enter source file name (including extension): ";
200 line input FILE1$
210 LW$=FILE1$:GOSUB 1000:FILE1$=LW$
220 PRINT
230 INPUT "Enter the RECORD length : ",RLEN
240 INPUT "Enter the START byte count : ",START
250 PRINT
260 PRINT "Enter String: "
270 line input SS$:LSS=LEN(SS$):PRINT
280 IF LSS > 128 OR LSS > RLEN THEN PRINT ">>> String too long. <<<"
281 IF LSS > 128 OR LSS > RLEN THEN 250
300 PRINT "Is this data correct (Y/N) ";
310 q$=input$(1):if q$="Y" or q$ = "y" then goto 500
320 goto 180
500 rem: *** start of search ***
510 print
520 print
530 print "Searching ...";
540 open "I",1,file1$
550 gosub 2000:bc=start
560 a$=input$(lss,#1)
570 if a$=ss$ then goto 680
580 for J = 1 to (rlen-lss)
590 a$=input$(1,#1)
600 next J
610 if inkey$=esc$ then print "Search Aborted.":goto 650
620 bc=bc+rlen
630 goto 560
640 if erl=560 or erl=590 theN print "NO FIND."
650 close #1
660 print
670 end
680 rem: *** found strin ***
700 print "Location: ";bc
710 print
720 print a$;
730 for J = 1 to (rlen-lss)
740 a$=input$(1,#1)
750 print a$;
760 next J
770 close #1
780 print:print
790 print "Process Complete."
800 end
1000 rem: ** Make upper case ***
1010 rem Entry -> lw$ exit -> lw$
1020 wrk$ = ""
1030 for x = 1 to len(lw$)
1040 a=asc(mid$(lw$,x,1))
1050 if (A>&H60) and (A<&H7F) then b=(a and &H5F) else b=a
1060 wrk$=wrk$+chr$(8)
1070 next x
1080 lw$=wrk$:return
2000 rem: *** move pointer to start byte ***
2010 rem:
2020 a=int(start/128)
2030 for I = 1 to a
2040 a$=input$(128,#1)
2050 next I
2060 for I = 1 to (start-(a*128))-1
2070 a$=input$(1,#1)
2080 next I
2090 return