Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting .tbl files 2

Status
Not open for further replies.

patwadd

Programmer
Nov 29, 2000
6
GB
I have a number of valuable archive files which were created using QBasic programs (supplier now out of business) and they all have a .tbl extension. My user wants the data transferred to an Access database or an Excel worksheet. The files contain compressed numeric data.

Can anyone suggest how I can do this?

Thank you
 
Do you have access to the source code that generated these files? Were these files created of a type 'Random access files' or of a database type? If of random access and you have the source code then it will be easy to convert to an access database. Can be done with visual basic, I can help you.
David Paulson


 
dpaulson is right.

Any file can be made to have the .tbl extension.

BUT! if you have the source code that will definitly help in creating a conversion program to decompress it to ASCI code and then use ACCESS to read and save as desired.
 
Thank you for your replies.

Regretfully, I do not have the source, only the files. However, looking at the file structures (they appear to be records of different length in some of the files), I would say they are reandom access.

Thank you
Pat Waddington
 
First of all, not having the source code, well, I do hope your getting paid by the hour. Here is some code that I whipped up. This is to determine what length each record is.This is also assuming that it is in random access, and that there is at least some text that will be recognizable.
This program will print out some lines of the file and you will try to determine a pattern. Each record should line up vertically when you are at the right file length.

Code:
OPEN "d:\backup\david\custfile.dat" FOR BINARY AS #1 'put your file in here
FOR filelen = 1 TO 32767
CLS
oldtext$ = STRING$(filelen, 32)
FOR search = 1 TO 5 'print 5 records in a row
                    'You can change this if you need more displayed
GET 1, search * filelen, oldtext$
PRINT LEFT$(oldtext$, 79) 'You may have to play with this 
'part if there is no recognizable characters in the first 79
NEXT search
PRINT "File Length = "; filelen
WHILE x$ = "" 'wait till a key is pressed
x$ = INKEY$
WEND
x$ = ""
NEXT filelen
close #1

Try this for a start. Let me know what happens.
David Paulson


 
Gee, how could I have missed this one. :-0

Random access files are of equal record lengths. We also can find out the length of the data file with lof(1), so we only need to look at the records that are evenly divisable into the length of the file.
Code:
OPEN "d:\backup\david\custfile.dat" FOR BINARY AS #1
FOR filelen = 1 TO 32767
IF LOF(1) MOD filelen = 0 THEN 'only check probable file lengths
CLS
oldtext$ = STRING$(filelen, 32)
FOR search = 1 TO 10
GET 1, search * filelen, oldtext$
PRINT LEFT$(oldtext$, 79)
NEXT search
PRINT "File Length = "; filelen
WHILE x$ = ""
x$ = INKEY$
WEND
x$ = ""
END IF
NEXT filelen
David Paulson


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top