I've done this in the past as well, this is how I went about it;
//declare variables
Private cline, d, q, qt, i, xWord
* Open file and Determ how many spaces there are in the *text.
#Define TextFile "C\Temp\Textfile.TXT"
f = new File()
if f.exists(TEXTFILE) //Does the file exist?
f.open(TEXTFILE, "A"

//Open in archive mode.
else
* do something if does not exist.
endif
Create Table "TextTable.dbf" (;
WordNum Number(5),;
Word Char(32)) // Enlarge if necessary
f.seek(0) //position the cursor at the begining of file.
d = new Database() // initiate Database (OODML)
d.databaseName = "Text" //Describe Database
d.active = True // make active
q = new query() //intiate query
q.database = d // assign database
q.Sql = 'Select * from "TextTable"' //assignment of table
q.active = True // make active
qt = q.rowset
i = 1
do
cLine = f.gets( 10000, chr( 0x8d ) ) // Soft carriage return (U.S.)
x = 0
y = x
do
y = cline.indexof(Chr(32), x) //location of space
xWord = cline.substring(x, y).lefttrim().rightTrim()
qt.beginappend()
qt.fields["Wordnum"].value = i
qt.fields["word"].value = xWord
qt.save()
i++ //increment 1 for next WordNum field value
y++ //move the starting point over 1
x = y //x == y as the new starting point of next word
until y = -1 //indexof seach fails.
until f.eof //continue till end of textfile
f.close() //close textfile
q.active = False // close tables
d.active = false // close database
release cline, d, q, qt, i, xWord
return
//you may have to make some adjustments depending on your textfile and the carriage returns used in its construction.
you can also include a variable for the line number and create an additional field in the create table statement to capture that information.
For XDML language you will need to do a Use statement to open tables and an Append Blank with Replace statement to insert data into table. if you need more info email me.
have fun.
RRiley