Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

superprutser (TechnicalUser) (OP)
18 Oct 02 4:47
I want to import a text file into a database. The text is not delimited.
Length of each line is 387 characters
The size of the complete textfile is 64.445.661 bytes
Each line has the same structure.

What is the solution for importing this file into a database???
Helpful Member!  ramani (Programmer)
18 Oct 02 5:00
Hi superpruster,

1. If you have a carriage return at the end of each line, then you can use..
=ALINES(myArray,FILETOSTR(myTextFile))

2. If however, this is not having the carriage return every 387 characters (your record length).. then..

myText = FILETOSTR(myTextFile)
myTotLines = LEN(myText)/387

x=1
FOR x=1 to myTotLines
   i=1+((x-1)*387)
   myEachLine = SUBSTR(myText,i,387)
   ** Store or further strip and updte your table
ENDFOR

Hope this helps you

ramani
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

danceman (Programmer)
18 Oct 02 7:52
If I understand your question correctly, each row of data is a record and each field is a fixed length in the row.  If this is true, then look at option of SDF from the append from command

USE mytable
APPEND FROM mytext TYPE SDF

An SDF file is an ASCII text file in which records have a fixed length and end with a carriage return and line feed. Fields are not delimited. The file name extension is assumed to be .txt for SDF files.

Attitude is Everything

superprutser (TechnicalUser) (OP)
22 Oct 02 16:34
I have tried to import the file with alines......
that works until a box appears with the text SUBSCRIPT IS OUTSIDE DEFINED RANGE.
Again I have a problem.........

The total size of the text file is 64.445.661 bytes
The first line (Header) contains 84 characters
The other lines (Detail) contains 387 characters each
The last line (Trailer) contains 7 characters

Total lines to import 195145

WHAT DO I HAVE TO DO TO IMPORT THIS FILE COMPLETELY INTO A DATABASE???????
ramani (Programmer)
22 Oct 02 16:51
HI

1. Create a table with the appropriate file structure.(New table created using VFP)
2. Now use the VFP editor to open the text file.
   MODI FILE myFile.txt
   Delete the first line, and Delete the last trailer line.
   SAVE AS a myFile1.txt
3. Now.. Open the file created in step 1 with command
   USE myTable
   and append.. using code..
   APPEND FROM myFile1.txt SDF

Hope this solves your problem

ramani
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

wgcs (Programmer)
22 Oct 02 22:05
If Ramani's suggestion doesn't solve your problem, please post a section of your file, including the First Line, several of the middle lines, and the Last Line.
superprutser (TechnicalUser) (OP)
23 Oct 02 3:00
Great thank you this is what I needed!!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close