lcTable = "maytable" >lcPath = "C:\mypath\" > ><b>lnFH = FOPEN(lcPath + lcTable + ".cdx", 12)</b> Typo here. lnFH = FOPEN(lcPath + lcTable + ".dbf", 12) && Correct line > >* Check if there is structural CDX >= FSEEK(lnFH,28) >lnByte28 = ASC(FREAD(lnFH,1)) >lnCDXStr = BITAND(lnByte28, 1) > >IF lnCDXStr = 1 && there is CDX > IF FILE(lcPath + lcTable + ".cdx") > ERASE (lcPath + lcTable + ".cdx") > ENDIF > = FSEEK(lnFH,28) > = FWRITE(lnFH, Chr( BITAND(lnByte28, 0xFE) )) >ENDIF > >= FCLOSE(lnFH) >Thanks a lot, Sergey, I'll try some more tests.