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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export .Dat to SQL-server

Status
Not open for further replies.

ErrorFlynn

Programmer
Nov 21, 2013
2
0
0
SE
I currently got a legacy program on my table. The program was written almost 30 years ago (1984) and have been running since.
The customer want to transfer data to a SQL-server.
I do not have the source code but the client claims that Pascal was used so therefor I post in this forum since my Pascal knowledge is some what limited(nonexistant)
Is there some way to see if it is a Pascal datafile and if it is how do I get it to a SQL server?

With hope for help
Tomas
 
Hi

Tomas said:
Is there some way to see if it is a Pascal datafile and if it is how do I get it to a SQL server?
There is no such thing like "Pascal datafile". There is no way to find out the structure from the data files. You can only guess.

If you can start over with a clean data file and check the changes after each operation you do with the program, then you have a chance to guess enough to be able to write an (partial) export tool.

But if the records can have variable length and certain data types are packed somehow, you will have to debug the program itself too. Be prepared for a task hard even for a Pascal guru.

An alternative if the program has text user interface and displays the data from the file in a fairly structured manner, to run it in a terminal emulator, send it keystrokes to navigate over the data file then save the text displayed in the terminal on each step. Then write a program which parses the saved texts and rebuilds the data. Of course, coding such automation can be a tedious task and such solution can be extremely slow.

Before beginning, have you searched the web ? Maybe someone had to do the same migration in the past and published his experiences.

Feherke.
feherke.github.io
 
Hi,

Thank you for your reply :)
I have searched the web but I do not have that much to go on.
I found a post in this forum regarding .Dat to txt migration that is simular.
If I can get it to a deliminated text that's enough.
I have opened it in Notepad++ and I can see the data but I can not find how it is separated. A lot of NUL segments.
Was thinking about doing a macro that cleans the file.
 
Hi

Tomas said:
I can see the data but I can not find how it is separated.
Most probably there is no separator. If you are lucky, those are fixed length records. See how the file size changes when you add new records. If the size always increases with the same amount, then try to split the files content in chunks of that size. ( Start splitting from the end. At the beginning of the file may be an additional header piece of different size. ) The putting the chunks one below the other, search for similarities to guess the field limits.


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top