FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A little big problem with command SORT on DBT files
Posts: 99
Joined: Thu Jul 12, 2007 02:02 PM
A little big problem with command SORT on DBT files
Posted: Thu Jul 12, 2007 03:41 PM
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


#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]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: A little big problem with command SORT on DBT files
Posted: Thu Jul 12, 2007 03:59 PM

I confirm the bug and I'm going to report it to the Harbour and xHarbour developers list.

Thank you!

EMG

Continue the discussion