Page 1 of 1

A little big problem with command SORT on DBT files

Posted: Thu Jul 12, 2007 3:41 pm
by MaxP
HARBOUR 7.01 2007 build.
I have a problem with command SORT on DBT files.
After execution of command SORT, the file DBT loose data.
Is it my fault or is this a real BUG ?

Ciao and thanks
Massimo

Code: Select all

#include "Fivewin.ch"

FUNCTION MAIN()
        LOCAL   cNameD := "BEGSORT.DBF"
        LOCAL   cNameM := "BEGSORT.DBT"
        LOCAL   cNameDS := "ENDSORT.DBF"
        LOCAL   cNameMS := "ENDSORT.DBT"
        LOCAL   aStr := { { "FLDDESCR", "C", 40, 0 }, ;
                          { "FLDMEMO",  "M", 10, 0 } }

        IF FILE( cNameD )
                FERASE( cNameD )
        ENDIF
        IF FILE( cNameM )
                FERASE( cNameM )
        ENDIF

        IF FILE( cNameDS )
                FERASE( cNameDS )
        ENDIF
        IF FILE( cNameMS )
                FERASE( cNameMS )
        ENDIF


        DBCREATE( cNameD, aStr )

        USE &cNameD

        APPEND BLANK
        REPLACE FLDDESCR WITH "First record"
        REPLACE FLDMEMO  WITH "First memo record"

        APPEND BLANK
        REPLACE FLDDESCR WITH "Second record"
        REPLACE FLDMEMO  WITH "Second memo record"

        SORT ON FLDDESCR TO &cNameDS

        USE
        
        MessErr( "After sort the file memo ENDSORT is empty ?????" )
        
        USE ENDSORT
        MessErr( ALLTRIM( FIELD->FLDDESCR ) + " <" + FIELD->FLDMEMO + ">" )
        SKIP
        MessErr( ALLTRIM( FIELD->FLDDESCR ) + " <" + FIELD->FLDMEMO + ">" )
        USE
RETURN NIL

FUNCTION MessErr( Mess )
        MsgBeep()
        MsgAlert( Mess, "ATTENZIONE" )
RETURN NIL
[/code]

Re: A little big problem with command SORT on DBT files

Posted: Thu Jul 12, 2007 3:59 pm
by Enrico Maria Giordano
I confirm the bug and I'm going to report it to the Harbour and xHarbour developers list.

Thank you!

EMG