Page 1 of 1

APPEND FROM ... SDF

Posted: Fri Mar 10, 2006 9:57 am
by E. Bartzokas
I don't really know if this an XHB error or FWH error.

It worked before Feb 2006 (XHB and FWH), but now it crashes

Code: Select all

   Error description: Error DBFCDX/1023  Exclusive required

   Called from:  => __DBPACK(0)
   Called from: dbsdf.prg => __DBSDF(241)
   Called from: IMP_CLK.PRG => IMPORT_HRS(343)

   Line 343 contained this below, but never had problems before 10/mar/2006

   append from (xClPath+"_MAST.TXT") SDF   
My search for DBSDF.PRG in FWH\SOURCE failed of course ...

The original code was as this:

Code: Select all

   Create (xClPath+"_MIMP.DBF") FROM (xClPath+"_MAST.STR")
   newinfile := Select()
   SELECT (newinfile)
   append from (xClPath+"_MAST.TXT") SDF
   (newinfile)->(DBCLOSEAREA())
My solution was to add this line:

Code: Select all

   Create (xClPath+"_MIMP.DBF") FROM (xClPath+"_MAST.STR")
   newinfile := Select()
   SELECT (newinfile)
   USE (xClPath+"_MIMP.DBF") alias QQQQ EXCLUSIVE  //  added
   append from (xClPath+"_MAST.TXT") SDF
   (newinfile)->(DBCLOSEAREA())
Any advise ?

Regards, saludos
Evans

Re: APPEND FROM ... SDF

Posted: Fri Mar 10, 2006 10:09 am
by Enrico Maria Giordano
The following sample works fine. Can you modify it to reproduce the problem?

Code: Select all

FUNCTION MAIN()

    USE TEST SHARED

    COPY TO TMPTEST FOR .F.

    USE TMPTEST SHARED

    APPEND FROM TEST

    GO TOP

    BROWSE()

    CLOSE

    FERASE( "TMPTEST.DBF" )

    RETURN NIL
EMG

Re: APPEND FROM ... SDF

Posted: Fri Mar 10, 2006 2:53 pm
by E. Bartzokas
Sorry for the long example.
This example you can save in \FWH\SAMPLES and run it.
I use XHB Professional ver. 4.01 Jan 24 2006 09:15:21

APPEND FROM ... DATABASE works fine.
APPEND FROM ... SDF does not work (see the error below)

Thanks for the interest
regards
Evans

Code: Select all

#INCLUDE 'FIVEWIN.CH'

Function MAIN()

   // This example was ran in FWH\SAMPLES
   
  USE CUSTOMER SHARED

    COPY TO TMPTEST.TXT FOR RTrim(first) == 'Homer' SDF  //  SDF correctly outputs 5 records
    COPY TO TMPTEST.DBF FOR RTrim(first) == 'Andy'       //  DBF correctly outputs 2 records
    
    USE TMPTEST SHARED
    BROWSE()                     // Contains 2 records

    APPEND FROM TMPTEST.TXT SDF  // SDF crashes here !!!
    
    /*
      Error description: Error DBFNTX/1023  Exclusive required
      Stack Calls
      ===========
      Called from:  => __DBPACK(0)
      Called from: dbsdf.prg => __DBSDF(241)
      Called from: APPEND_FROM.PRG => MAIN(15)
    */

    GO TOP
    BROWSE()
    CLOSE
    FERASE( "TMPTEST.TXT" )    // .TXT !!!

    RETURN NIL
    


// Suggested solution by Antonio - Must be added to a PRG

#pragma BEGINDUMP 

#include "hbapi.h" 
#include "hbapiitm.h" 

PHB_SYMB hb_dynsymSymbol( PHB_DYNS pDynSym ) 
{ 
return pDynSym->pSymbol; 
} 

#pragma ENDDUMP 
  

 

Re: APPEND FROM ... SDF

Posted: Fri Mar 10, 2006 3:07 pm
by Enrico Maria Giordano
Confirmed. Already reported in the xHarbour developer's mailing-list.

Thank you.

EMG

Re: APPEND FROM ... SDF

Posted: Fri Mar 10, 2006 4:11 pm
by Richard Chidiak
E. Bartzokas wrote:Sorry for the long example.
This example you can save in \FWH\SAMPLES and run it.
I use XHB Professional ver. 4.01 Jan 24 2006 09:15:21

APPEND FROM ... DATABASE works fine.
APPEND FROM ... SDF does not work (see the error below)

Thanks for the interest
regards
Evans

Code: Select all

#INCLUDE 'FIVEWIN.CH'

Function MAIN()

   // This example was ran in FWH\SAMPLES
   
  USE CUSTOMER SHARED

    COPY TO TMPTEST.TXT FOR RTrim(first) == 'Homer' SDF  //  SDF correctly outputs 5 records
    COPY TO TMPTEST.DBF FOR RTrim(first) == 'Andy'       //  DBF correctly outputs 2 records
    
    USE TMPTEST SHARED
    BROWSE()                     // Contains 2 records

    APPEND FROM TMPTEST.TXT SDF  // SDF crashes here !!!
    
    /*
      Error description: Error DBFNTX/1023  Exclusive required
      Stack Calls
      ===========
      Called from:  => __DBPACK(0)
      Called from: dbsdf.prg => __DBSDF(241)
      Called from: APPEND_FROM.PRG => MAIN(15)
    */

    GO TOP
    BROWSE()
    CLOSE
    FERASE( "TMPTEST.TXT" )    // .TXT !!!

    RETURN NIL
    


// Suggested solution by Antonio - Must be added to a PRG

#pragma BEGINDUMP 

#include "hbapi.h" 
#include "hbapiitm.h" 

PHB_SYMB hb_dynsymSymbol( PHB_DYNS pDynSym ) 
{ 
return pDynSym->pSymbol; 
} 

#pragma ENDDUMP 
  

 
I have reported this bug over a month ago in the xharbour ng with a sample, but no one replied !!!!! :?

A fix will be opening the file "exclusive"
:)
Richard

Posted: Fri Mar 10, 2006 6:08 pm
by Antonio Linares
You may directly report it to Przemek at druzus@priv.onet.pl as he is the RDDs best expert.