cricket
Yes, I am using ALLTRIM when I am ordering the table, although in this case I fail to see how it would make any difference as the field width is 5 characters and every record is exactly 5 bytes long. See my last post about the verifications I did. See below where I show that I am using ALLTRIM.
brigmar
So far as I know, my TORDER UDF is not causing the problem. However, I did not replace it with straight SELECT and ORDER statements to find out. I will do that and see what happens.
Meanwhile, here is the code for TORDER and TOPEN for you to look at just in case there is a problem there that I do not see.
[tt]
*******************
*
* FUNCTION NAME: TORDER
*
*******************
*
* Select and order open table.
*
* SYNTAX:
* = TORDER(<table file>[, <tag name>])
*
* ENTRY:
* <table file> = alias of table to get data from
* <index tag name> = name of index tag to order table with
* EXIT:
*
* REMARKs:
* SELECTs table in open workarea - works exactly like
* SELECT(ALLTRIM(<table file>)
* *Table MUST be already open in some workarea*
* If <index tag name> defined, also SETs ORDER TO order
* specified by index tag.
* ALLTRIMmed because must be EXACT match.
*
*******************
FUNCTION TORDER
PARAMETERS qTableName, qIdxTagName
qTableName = TOPEN(qTableName)
SELECT (qTableName)
IF NOT EMPTY(qIdxTagName) AND TYPE('qIdxTagName') = "C"
SET ORDER TO TAG (ALLTRIM(qIdxTagName)) IN (ALLTRIM(qTableName))
ENDIF
RETURN
[/tt]
[tt]
*******************
*
* FUNCTION NAME: TOPEN
*
*******************
*
* Open one table.
*
* SYNTAX:
* = TOPEN(<table name>)
*
* ENTRY:
* <table name> = name of table
* MUST include table name - Path & Extension optional
* Path defaults to value of SET PATH - Extension defaults to '.DBF'
* EXIT:
*
* RETURNs:
* Alias of table
*
* REMARKs:
* Opens table in first available workarea. Table MUST already exist or
* "file <<fullpathname>> does not exist" error is returned.
*
*******************
FUNCTION TOPEN
PARAMETERS qTableName
PRIVATE ALL LIKE z*
zalias = IIF(TYPE('qTableName') = 'C', qTableName, '')
IF NOT EMPTY(zalias)
qTableName = ALLTRIM(qTableName)
zpath = JUSTPATH(qTableName)
zalias = JUSTNAME(qTableName)
zext = IIF(EMPTY(RAT('.', qTableName)), '.DBF', SUBSTR(qTableName, RAT('.', qTableName)))
zpath = IIF(EMPTY(zpath), SET('PATH'), zpath) + zalias + zext
IF NOT USED(zalias)
USE (zpath) AGAIN ALIAS (zalias) IN 0
ENDIF
ENDIF
RETURN zalias
[/tt]
DSummZZZ
Yes and no. I have tested my code against a different DBF (see above) but I have NOT checked my DBF file against different code. So I tested my DBF in the command window and got these results:
[tt]
CLOSE DATA
USE "MHD

esktop Folder

roDev:TPtsDBF

BF:SCF2St.DBF" EXCLUSIVE
SET ORDER TO TAG Pscf OF "MHD

esktop Folder

roDev:TPtsDBF

BF:SCF2St.CDX"
GO 20
a = Pscf
?a
28900
?type('a')
C
?seek(left(a,1))
.T.
?seek(left(a,2))
.T.
?seek(left(a,3))
.T.
?seek(left(a,4))
.F.
?seek(left(a,5))
.F.
?seek(a)
.F.
[/tt]
Note that I extracted a value from the table and used that value in the SEEKs.
Note especially that it could NOT even find ITSELF!!!! Note also that these are the SAME EXACT results that I have been getting in my app, so somehow someway the problem MUST lie in the DBF file. Tis really screwy if you ask me.
I did not recreate the index from scratch. Will do that also since corrupted indices can produce all kinds of screwy results. Will post the results tomorrow if I can.
mmerlinn
"Political correctness is the BADGE of a COWARD!"