Possible bug in INDEX ON Descend()

98 views
Skip to first unread message

José Quintas

unread,
Dec 5, 2013, 5:41:29 PM12/5/13
to harbou...@googlegroups.com
Attached a sample with possible bug.

PROCEDURE Main
SET DATE BRITISH
USE jpprehis
INDEX ON phItem + phCadas + phForPag + Descend( Dtos( phData ) + phHora
) TO jpprehis
Browse()
USE
RETURN

Result first 2 records are not indexed correctly:

│003020 082439 000014 05/12/13 16:55:56 2.0340 TESTE 2013-12-05
│003020 082439 000014 02/12/13 16:55:47 2.0340 TESTE 2013-12-02
│003020 082439 000014 19/03/13 16:27:28 2.0340
│003020 082439 000014 06/03/13 2.0497 REAJ.4.15000
│003020 082439 000014 31/01/13 1.9680
│003020 082439 000014 30/01/13 1.9758 REAJ.5.09400
│003020 082439 000014 31/12/12 1.8800

Note: Date format: DD/MM/YY

José M. C. Quintas

test.zip

José Quintas

unread,
Dec 5, 2013, 5:50:08 PM12/5/13
to harbou...@googlegroups.com
When make last test to post here, result is ok.

I can't understand.

José M. C. Quintas

José Quintas

unread,
Dec 5, 2013, 6:19:13 PM12/5/13
to harbou...@googlegroups.com
Can't reproduce isolated bug.

index keys:

IndexInd( "item",
"phItem+phCadas+phForPag+Descend(Dtos(phData)+phHora)" )
IndexInd( "cadas", "phCadas+phItem+phForPag+Dtos(phData)" )
IndexInd( "data", "Dtos(phData)+phItem+phCadas+phForPag" )

file DBF and CDX attached.

My Index routine in application is the same: 2 years old in Harbour,
several years old in Clipper.

RddSetDefault( "SIXCDX" )
Sx_AutoOpen( .F. )

browse in dbf - OrdSetFocus( "item" )

003020 082439 000014 02/12/13 16:55:47 2.0340 TESTE
2013-12-02
003020 082439 000014 05/12/13 16:55:56 2.0340 TESTE
2013-12-05
003020 082439 000014 19/03/13 16:27:28 2.0340
003020 082439 000014 06/03/13 2.0497 REAJ.4.15000
003020 082439 000014 31/01/13 1.9680
003020 082439 000014 30/01/13 1.9758 REAJ.5.09400
003020 082439 000014 31/12/12 1.8800

First 2 records are not in correct order.

Once I use routine for 2 years, for all databases, I can't believe that
anything is wrong in routine.

How I can check the CDX file to try discover anything?
There are 7 records only, indexed by application.

José M. C. Quintas
JPPREHIS.zip

José Quintas

unread,
Dec 5, 2013, 6:26:45 PM12/5/13
to harbou...@googlegroups.com
Ok. Reproduce the bug.
Occurs when using codepage.
Same DBF attached in previous post.
NOTE: keys have number only.

REQUEST HB_CodePage_PTISO
REQUEST SIXCDX

PROCEDURE Main
SetMode( 24, 80 )
Set( _SET_CODEPAGE, "PTISO" )
SET DATE BRITISH
USE JPPREHIS
INDEX ON phItem + phCadas + phForPag + Descend( Dtos( phData ) +
phHora ) TAG item
Browse()
USE
RETURN

José M. C. Quintas

Sergy

unread,
Dec 6, 2013, 3:02:09 AM12/6/13
to harbou...@googlegroups.com
Hello Jose

I faced with strange behavior of DESCEND() in my "clipper-era" and sucessfully replaced it with (0-nValue) index key.

Try it.

WBR, Sergy,
Reply all
Reply to author
Forward
0 new messages