As this condition
'Usage Charges' $ laArray(I)
can't be rushmore optimized, it'll require a scan even with a cursor.
In this case, arrays and cursors will probably compete in terms of speed.
This is what I would try:
create cursor ...
index on 'Usage Charges' $ fieldx tag Usage binary
index on 'Minimum Guarantee' $ fieldx tag MinGar binary
append from ...
scan for 'Usage Charges' $ fieldx
... your code
endscan
You can also optimize your existing code:
(1) read array elements only once
el = laArray[m.i]
... m.el ...
(2) use
x = iif(cond, y, z)
instead of
if cond
x=y
else
x=z
endif
(3) same for iCase() vs do case ... endcase
(4) using 'm.' may also help a little, especially if alias() has many fields
>Thanks Madam.But ASCAN() Will search for the Exact existence of record. is it possible with ACSN () to search like record, I mean to say that
>If the Array Element consist of "F2 B (Usage Charges)387 530 w" than is it possible to search 'Usage Charges' from Array element and Extract 300 from it using ASCAN.
>
>currently I am Scanning the entire array using For ENFOR and using IF 'Usage Charges' $ laArray(I)=.T., like this
>
>
>FOR I= 1 TO nU1
>>>>IF 'Usage Charges' $ laArray(I)=.T.
>>>>lnRowposition = VAL(GETWORDNUM(laArray(I), GETWORDCOUNT(laArray(I)) - 1))
>>>>lnLeftColumnposition = GETWORDNUM(laArray(I), GETWORDCOUNT(laArray(I)) - 2)
>>>>lnLeftColumnposition=VAL(STREXTRACT(lnLeftColumnposition,')',''))
>>>>EXIT
>>>>ENDIF
>>>>ENDFOR
>
>
>Kinldy Guide
>
>
>
>
>>>I am trying to some Extract Data from a Text file and preform some Manipulation on it.
>>>
>>>For Extraction of Data I have two options, 1st create a cursor using Append from abc.txt SDF and Use The Locate Command to find my Data inside and extract it.
>>>
>>>2nd Use an Array. Initially I opted the second option. Now, to extract the Data from The array I am Scaning the entire Array from top Until the record is Matched, but since the volume of Data to be extracted from ech file and the number of files are also too Large, its taking huge time for entire processing.
>>
>>Just want to point out that the fast way to search in an array is with ASCAN().
>>
>>Tamar
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/Never explain, never complain (Queen Elizabeth II)