Information générale
Catégorie:
Codage, syntaxe et commandes
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement