Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing A File
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00469068
Message ID:
00469081
Vues:
16
>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

append from c:\temp\test.txt type deli with charac "*"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform