Importing A text file

stufine

New Member
I have a text file that is ~ delimited.
I am trying to figure out how to import it into my database.

I have gone through the documentation, but I cannot find a good explanation on how to do this. Could anyone help me.

Thanks in advance

Stufine
 

ss_kiran

Member
Importin delimiter

hi,
did you try this:
Input from <file-name>.
import delimiter '~' <fld-nam1> <fld-nam2> ...

hope this helps.

regards
Kiran S Shankar
 

rcottrell

New Member
You can call the text file into a text editor (Notepad, Wordpad, Ultraedit, Textpad or what ever) and replace every occurrence of '~' with some other character like a comma.
 

stufine

New Member
I have tried all of this. So maybe I did not set up my database correctly.

I go into data administration and choose import data then Delimited Text and I put my ~ delimiter in and it comes back with
0 records in Delimited ASCII format loaded into movielist.

Here is a sample of my text file:
1~12 Monkeys~Bruce Willis~Brad Pitt~Madeline Stowe~R~Action~Excellent~Video

And the fields in my table are:
Movieid, movietitle, actor,supporting_actor, supporting_actor2, rating,subject, review, videodvd

I created the database using data administration
 

ss_kiran

Member
delimiter

Hi,
why dont you use the quoter function which will replace all the "~" with double quotes

syntax quoter -d ~ input file-name > output file-name
and the resulting file will have something like this and then you can use the data dictionary to load the same.

"1" "12 Monkeys" "Bruce Willis" "Brad Pitt" "Madeline Stowe" "R" "Action" "Excellent" "Video"

thanks
kiran Shankar
 

Crittar

Member
Try something like this:

Code:
DEFINE TEMP-TABLE mytab
  FIELD fld1 AS INTEGER
  FIELD fld2 AS CHARACTER FORMAT 'x(20)'
  .
  .
  .
  FIELD fldn AS CHARACTER FORMAT 'x(20)'. /* Use apprpropriate types and formats for your data */

INPUT FROM /path/file NO-ECHO. /* substitute the required path and file */

REPEAT TRANSACTION:

CREATE mytab.
IMPORT DELIMITER '~~' mytab. /* Use double tilde as tilde is special character in Progress */
END.

INPUT CLOSE.

I've tested this on a small sample and it works.

Hope this helps.
 

Crittar

Member
I should have said in my previous post: Substitute the name of your database table for the temp-table I used in my example.

:)
 
Top