Category : Files from Magazines
Archive   : IMB9010.ZIP
Filename : SB3.BAS

 
Output of file : SB3.BAS contained in archive : IMB9010.ZIP
'PROGRAM - SRCHBLNK.BAS

'****************************************************************
'** Purpose - This program demonstrates how to search for blank *
'** fields *
'****************************************************************

CLS

'****************** Setup ISAM file **************************

TYPE SampleRecord
Field1 AS STRING * 20
Field2 AS STRING * 20
END TYPE

DIM SR AS SampleRecord 'Record variable to move data
' in and out of file

OPEN "TestFile.MDB" FOR ISAM SampleRecord "Table1" AS #1

CREATEINDEX #1, "FIELD1INDEX", 0, "Field1"
SETINDEX #1, "FIELD1INDEX" 'Set the active index

'******************* Add records to file **********************

RANDOMIZE TIMER
PRINT "Creating records": PRINT
FOR I = 1 TO 100
R$ = "REC" + STR$(I)

IF INT(20 * RND) = 10 THEN
SR.Field1 = ""
PRINT "Blank field record "; I
ELSE

SR.Field1 = R$ + " Field1 "
END IF

IF TEXTCOMP(SR.Field1, "") = 0 THEN SR.Field1 = "~"

SR.Field2 = R$ + " Field2 "
INSERT #1, SR
NEXT I

'****************** Scan for blank Field1 ********************

MOVEFIRST #1 'Set initial file postion
PRINT : PRINT "Searching for blank fields": PRINT

SEEKEQ #1, "~" '
DO
RETRIEVE #1, SR
IF TEXTCOMP(SR.Field1, "~") = 0 THEN
PRINT "Found it "; SR.Field1; SR.Field2
ELSE
EXIT DO
END IF
MOVENEXT #1
LOOP

PRINT
PRINT "End of file reached. Terminating program."

CLOSE 1
KILL "TESTFILE.MDB"
END



  3 Responses to “Category : Files from Magazines
Archive   : IMB9010.ZIP
Filename : SB3.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/