Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting wierd ASCII file to readable database format
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00215249
Message ID:
00215311
Views:
28
>Hello!
>
>I recieved a wierd ASCII file from a client of ours. He wants to have this ASCII file converted to a database format so I can make a VFP 6 application for him.
>
>The first line looks something like this:
>
>1 't Casteelken St.Pe s & Paulusstraat 2 8800 RUMBEKE 051/20.98.11 051/22.10.63
>
>All in one line (not several as in this message).
>
>The second line:
>2 't Meubelhof Rijksweg 477 3630 MAASMECHELE 089/76.19.23 089/77.18.16
>
>That it. But there isn't a real concistincy in it. It would be easy that all the fields would have a fixed length in every line. Not the case. On one line it's 20 and the other is 30 for instance.
>
>It's also quite a big file so editing it to proper format is to much work.
>
>Are there any good utilities to read wierd ASCII formats and convert them to a normal (.dbf for instance) format?
>
>Anyway to program something like this in VFP?
>
>Thanks for your feedback!

Michiel,

I don't think there is any "magic" bullet available to solve this problem for you, but you have received some good suggestions already. Based on the two lines of the file shown here, there is some consistancy? If you look in the beginning they both start with a number (sequential?) and then are followed by a variable lentgh description of some kind. At the end of both lines are some numeric values that seems to be consistant in format of decimals and back slashes. I think you need a basic layout from the client (how many fields, what types, any known lentghs, etc.) and then you may need to make several passes. In the first pass, use the earlier suggestions to read the file one line at a time working right to left. You can have hard coded substr commands for the known fields lenghts and use AT() commands for the unknown field lenghts. So after the first pass, maybe you have half the fields correct. Then you make a second pass and try further corrections, and so on.

Kind Regards,

Mat
Matthew Kennedy
Decision Support Technology Inc.

"I try to take one day at a time, but sometimes several days attack me all at once." ~ Ashleigh Brilliant

New Jersey Dot Net User Group
Previous
Reply
Map
View

Click here to load this message in the networking platform