Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
TEXTCOMP Function Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'The following example uses TEXTCOMP to compare titles in a table named
'BookStock and then prints each title that begins with the word QuickBASIC.
'Because the comparison performed by TEXTCOMP is not case-sensitive, all
'variations of titles whose first word is QuickBASIC will be printed.
'Note: To run this program, you must load the ISAM TSR program PROISAM.EXE.
'Also, this program assumes files called BOOKS.MDB and BOOKLOOK.BI exist in
'the current directory. BOOKS.MDB is a sample ISAM file that SETUP copies
'to your disk.
'$INCLUDE: 'booklook.bi' 'RecStruct structure.
DIM BigRec AS RecStruct 'Define record variable.
OPEN "books.mdb" FOR ISAM Books "BookStock" AS 1 'Open the ISAM file.
SETINDEX 1, "TitleIndexBS" 'Set the index.
'Make first record with "quickbasic" as first word of title current.
SEEKGE 1, "quickbasic"
IF NOT EOF(1) THEN 'Quit if no match.
DO
IF EOF(1) THEN END 'Quit if end of table.
RETRIEVE 1, BigRec.Inventory 'Fetch record into BigRec.
'Compare retrieved record to "quickbasic" in same way comparisons
'are done by ISAM. If they don't compare equal, Quit program.
IF TEXTCOMP(LEFT$(BigRec.Inventory.Title, 10), "quickbasic") <> 0 THEN
END
END IF
LPRINT BigRec.Inventory.Title 'Print valid titles to
'the line printer.
MOVENEXT 1 'Make next record current.
LOOP
ELSE
PRINT "Sorry, SEEK for 'quickbasic' failed in BOOKS.MDB"
END IF