home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!ferrari.datamark.co.nz!david
- From: david@datamark.co.nz (David Rowland)
- Subject: Re: HELP: Loading text file to FoxPro database
- Message-ID: <1992Nov9.023732.29172@datamark.co.nz>
- Date: Mon, 9 Nov 1992 02:37:32 GMT
- References: <50990003@hpsgm2.sgp.hp.com>
- Organization: Datamark International Ltd.
- Lines: 53
-
- In article <50990003@hpsgm2.sgp.hp.com> thwaites@hpsgm2.sgp.hp.com (Damien THWAITES) writes:
- >
- >I have an ASCII text file that contains one field from a database per line.
- >As there are 20 fields in each record, there are 20 lines in the file for
- >each record. I want to load this text file into a FoxPro database with
- >the same number of fields (20) per record.
- >
- >How can I read this text file into a FoxPro database ? I tried using the
- >APPEND FROM command but FoxPro loaded each line of the text file as a
- >separate record. I need FoxPro to place each of the 20 lines into the
- >corresponding database record field. Any pointers are much appreciated !!
- >
- One of the easiest ways to change ascii files, believe it or not, is
- by using Qbasic which comes with MS-DOS 5. This package is not used
- to its full potential by alot of programmers which is a shame. Once I
- got use to it, I was using this package to format files etc alot
- faster then appending them to a database and using foxpro or clipper.
-
- An example program would be as follows:
-
- OPEN <old file> FOR INPUT AS #1
- OPEN <new file> FOR OUTPUT AS #2
-
- :LOOP
- A$=""
- FOR N=1 TO 20
- INPUT #1, B$
- A$=A$+B$
- NEXT
- PRINT #2, A$
- IF NOT EOF(1) THEN GO TO LOOP
-
- CLOSE #1, #2
-
- NOTE: I Dont have Qbasic available and wrote the above program from
- memory. It might have to be changed a bit but this should be easy.
- The end result would be a new file with one line per record.
-
- I have also been asked a similar question to this one before and
- discovered the file in question was infact a RTF file. If this is the
- case, a simple APPEND FROM <file> TYPE RTF will do the trick.
- Likewise, try to discover the format for the ascii file and see if
- foxpro can append from that format.
-
- Good Luck.
-
-
-
- --
- | David Rowland | The British are using New Zealanders. They must |
- | Datamark Intl Ltd | really mean business ! |
- | Wellington | - General Rommel During Northern African |
- | NEW ZEALAND | Campaign WWII. |
-