I am absolutely sure someone out there has done this before and likely better than the algorythm I'm placing here but it was just one of those AHA moments when Novarseg pointed out Seek #1,1 placed the pointer back to the beginning of a Sequential file. You have no idea how often I read that in the past and it never twigged to me that is was useful. I have been Opening and Closing the sequential files to get back to the beginning and the program slowed down so much it was ridiculous. I have just watched FellippeHeitor's recent video and he also points to Seek #1,1 as a useful tool in working with Sequential files.
So here is the simple program which appears to give Random Access to multiple Open Sequential files. The first thing to point out is, I had to convert the name of each sequential file to the same name and add a number to the end of the file name so I could open all 25 files quickly (or quicker than Opening all 25 with unique names one at a time). Then I have a loop there that captures the Last Record value for each of the 25 files. Helps with catching the End of File error but not necessary is you already know how many entries you have in your sequential files.
A true Random Access moves it's pointer forward and backward whereas this coding doesn't do that but gives the appearance that it does.
File$ = "DataFile"
ext$ = ".bas"
For y
= 1 To 25 ' This For Loop finds the last record in each of the 25 DataFiles RecordTot(y) = RecordTot(y) + 1
Print "To Exit Select 0 for either the File to access or the Record number to display" Print "Which File would you like to access: Note Files are Numbered 1 to 49";
Print "What Record number would you like to find ";
RecordSearch
'
Print " there are only ";
Print " Files in the Data Base ";
Print "DataFile "; FileNum;
" can not be accessed" Print "Press any key to continue"
If Record
> RecordTot
(FileNum
) Then Print RecordTot
(FileNum
);
Print " Records so Record #";
Print Record;
" can not be accessed"
Print "Record Value is ";
Print "Press any key to continue"