Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Character line more than 254!
Message
From
29/05/1998 03:17:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/05/1998 15:28:10
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00102865
Message ID:
00102999
Views:
20
>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.
* Table created and ready for input
* Open and selected
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
**
** No type differentiation for fields here but could be added easily
**
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform