Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing A File
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00469068
Message ID:
00469070
Views:
17
Are you using VFP 6.0? If so, take a look at the ALINES() function. It is very fast. I think you could also use the FILETOSTR() function to get the file into a string, then use the ALINES() function.

>I have a text file that I have to parse into a table. There are around
>47,000 lines in it.
>
>I don't have a file layout, but it is asteriCk-delimited as in:
>
>
>NOISAT, MARY *Z7700286-31*31.75**27.18*092600*G0001*0301**1*300*300***0*300*
>

>
>There are 2 problems here:
>
>1. I don't know the layout
>
>2. Some of the lines are VERY long, upwards of 800-1000 characters
>in length.
>
>If I can determine the length of the longest line, I can use OCCURS() to
>determine the number of asteriks in that line, and from that determine
>the number of columns to create.
>
>So I appended it into a memo field, then I ran this little program:
>
>
> SET MEMOWIDTH TO 8192
>
> USE Temp1
>
> nLineNo = 0
> nTotLines = MEMLINES(DataField)
> nMaxLen = 0
> nLongest = 0
>
> FOR nLineNo = 1 TO nTotLines
>
>   cString = ALLTRIM(MLINE(Data, nLineNo))
>
>   IF LEN(cString) > nMaxLen
>     nMaxLen = LEN(cString)
>     nLongest = nLineNo
>   ENDIF
>
> ENDFOR
>

>
>The problem is, this program take FOREVER to run, literally HOURS! I need
>a simpler solution.
>
>TIA
Chris McCandless
Red Sky Software
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform