A little big problem with command SORT on DBT files

Post Reply
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

A little big problem with command SORT on DBT files

Post 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]
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

Post 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
Post Reply