>Hi Jos,
>
>Here's one record from the dat file.
>999922887900000000....< edited >....000000000995000995REGNYNNNNYNREG
>
>I was successful in importing this into a one column dbf using the import from wizard, but want to automate the process using code.
>
>1. I need to download the dat file every night from a ftp site.
>2. The data then needs to be parsed and inserted into a vfp table.
>
>Do you know of a way to schedule the download of a ftp file and then run the VFP code to parse the data?
>
>Best regards,
Rixon.
1) If (a) each line in the dat file is a new record and (b) each line is a fixed length record then you should create a table with all the fields required to hold the seperate parts of the dat file record. eg: if the first part of the record above is "9999228879" then the first field in your table should be C(10) in size. Create a field for each part of the dat record. Then use APPEND FROM (cFileName) SDF to import the file into your table. It will automatically parse all the fields into your table structure.
2) FTP downloads require an FTP client. Check out
www.WestWind.com or search the UT download section for FTP. To schedule it you will need to either write a wait loop to test for the correct time to start the download or alternatively, you can use a timer object. Personally, I would create a download form with a timer on it and test for the correct time every 5 seconds. I would use the form to show the user a status and when the download will start.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.