>HI,
>
>I've received a file the has variable character line lenght.
>Formated to specific input from the source client application that cannot be modified(Not the same company).
>
>Information can be read as follow on one line:
>
>FieldsName Lenght
>AdType 1
>AdInfo 25
>AdDescr 150
>etc
>etc
>
>
>The line can easyly exceed 254 characters?
>
>Problem
>I cannot access information exceeding 254.
>
>I there a way i can access?
>
>I tried setting the memowidth to 1024, but no use.
>
>Any help from any one will be greatly appreciated.
>Thanks
>Bye
Nicolas,
1) Do a append from ... type ... if:
-All indiviual columns are <= 254
-Total line length exceeding 254 but <= 65024
-Existing columns in each line are fixed length -> Do an SDF import.
-Not fixed column lengths -> Then they should be delimited with something. Append from ... type delimited with ...
2) Again do a append from ... type SDF or delimited if:
- Columns are at fixed positions or delimited
- Any indiviual column(s) > 254
- Total line length < 65024 (255*254)
Here for those columns exceeding 254, first prepare ceiling(nSourceColumnLen/254) columns + one memo for it in your table. After appending replace the memo with concatanetion of those fields and drop the fields. (Use an intermediate cursor for easy manipulating).
3) Do it like this if : && This could replace all above too.
- Any total line lenght > 65024
For those columns exceeding 254 prepare memo fields. Open the file lowlevel with open, parse, put in table.
lparameters cTableName
dimension aColumnContents[fcount(cTableName)]
handle = fopen(myTxtFile)
nFileSize = fseek(handle,0,2)
=fseek(handle,0)
nMaxLineLen = min(nFileSize, 2*1024^3)
do while !feof(handle)
=ParseInsert2Table(fgets(handle, nMaxLineLen))
enddo
=fclose(handle)
Function ParseInsert2Table
lparameters cThisLine
nTotCount = 0
for ix = 1 to fcount(cTableName)
aColumnContents[ix] = ;
substr(cThisLine, nTotCount+1, ;
fsize(field(ix)))
nTotCount = nTotCount + fsize(field(ix))
endfor
insert into (cTableName) from array aColumnContents
Cetin