All you guru's out there:
The following code has two programmers completely stumped. The code fails to USE the indicated database right before the suspend in the following code snippet. It loops through this code 4 times and fails each time on the use. Then the select fails because it can't find the table.
One other thing, the method's error handler picks up an error 'Structural index not found'. These files are downloaded from a vendor's ftp site and have no index files associated with them. If I use the same macro expansion from the code window, it runs just fine.
However, if I place a suspend in the code before the &lcCmd macro, and run it from there, each table is used, and the the indexes created.
What's going on??
FOR lnIndex2 = 1 TO ALEN(aCursors,1)
lcCurName = ALLTRIM(aCursors(lnIndex2,2))
lcExt = ALLTRIM(UPPER(SUBSTR(aCursors(lnIndex2,3), RAT('.',aCursors(lnIndex2,3))+1)))
DO CASE
CASE lcExt == 'DBF'
&tcCnt..lblStatus.Caption = 'Creating data table from ' + ALLTRIM((aCursors(lnIndex2,3)))
lcFile = UPPER(thisform.cSourceDir + ALLTRIM(aCursors(lnIndex2,3)))
lcVar = ALLTRIM(aCursors(lnIndex2,5))
lcTag = ALLTRIM(aCursors(lnIndex2,4))
lcCmd = 'USE ' + lcFile + ' IN 0 ALIAS ' + lcCurName
&lcCmd
SELECT (lcCurName)
lcIndexCommand = 'INDEX ON ' + lcVar + ' TAG ' + lcTag
&lcIndexCommand
ENDCASE
ENDFOR