FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour [Solved]Error DBFCDX/1010 Read error
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Thu May 23, 2013 06:15 PM
Bayron wrote:The problem has to be that another user is using the file in mode exclusive...
That will give you a read error...


Check the function NetUseSub()
Code (fw): Select all Collapse
   While .t.

      //-- Abrir o arquivo - Verificando modo exclusivo e se usará Alias
      if lExcl
         if cAlias == NIL
            use (cTeste) exclusive
         else
            use (cTeste) alias (cAlias) exclusive
         end
      else
         if cAlias == NIL
            use (cTeste)
         else
            use (cTeste) alias (cAlias)
         end
      end

      //-- Se conseguiu abrir sai do loop
      if used() //-- Check this Bayron
         exit
      end

      Msg(cTeste + " Bloqueado...  Libere-o.  <" +alltrim(str(nRetry++))+ " tentativa>;;") //-- File blocked, release. 01..20 (st,nd,rd,th)

      //-- Caso não tenha conseguido em x tentativas, sai do loop
      if nRetry >= 21
         exit
      end

   end
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Error DBFCDX/1010 Read error
Posted: Thu May 23, 2013 08:49 PM

Did you check disk integrity?

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Thu May 23, 2013 11:13 PM
ADutheil wrote:Did you check disk integrity?

How can I do that?
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Error DBFCDX/1010 Read error
Posted: Thu May 23, 2013 11:16 PM

Open a prompt box and execute chkdsk (/? for help). You´ll probably be asked (chkdsk c: /R) to reboot to have the test done at startup.

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Thu May 23, 2013 11:58 PM

ADuthel, o erro só acontece nesse arquivo e ele já foi trocado(mais de uma vez), então é no mínimo improvável que seja esse o erro...
Mas vou requisitar que faça o teste.

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 01:55 AM
sambomb wrote:
Bayron wrote:The problem has to be that another user is using the file in mode exclusive...
That will give you a read error...


Check the function NetUseSub()
Code (fw): Select all Collapse
   While .t.

      //-- Abrir o arquivo - Verificando modo exclusivo e se usará Alias
      if lExcl
         if cAlias == NIL
            use (cTeste) exclusive
         else
            use (cTeste) alias (cAlias) exclusive
         end
      else
         if cAlias == NIL
            use (cTeste)
         else
            use (cTeste) alias (cAlias)
         end
      end

      //-- Se conseguiu abrir sai do loop
      if used() //-- Check this Bayron
         exit
      end

      Msg(cTeste + " Bloqueado...  Libere-o.  <" +alltrim(str(nRetry++))+ " tentativa>;;") //-- File blocked, release. 01..20 (st,nd,rd,th)

      //-- Caso não tenha conseguido em x tentativas, sai do loop
      if nRetry >= 21
         exit
      end

   end


Well, where is lExcl comming from???

I am guesing that you are forcing it to open in exclusive mode or not, but if the database is open by someone else either in exclusive or shared mode, you won't be able to open it in exclusive mode... And if is open in exclusive mode by someone, you wouldn't be able to open it either in exclusive nor shared mode...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 02:01 AM
Bayron,

lExcl is defined earlier in the function

Code (fw): Select all Collapse
lExcl  := if(cExcl   == NIL .or. cExcl == "", .f., .t.)


I noticed he is passing 7 params to the function while it´s expecting only 6 but that should not make any difference.

Code (fw): Select all Collapse
!NET_USESUB(SZero(pCodCli,5), , ,"INFOPAF", , ,.T.)//NET_USESUB(cFile, cIndex, cExcl, cAlias, lNovaArea, cSub)
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 02:09 AM
Samir,
is the value of local 1 from function VERIFICAARQUIVOAUXILIAR expected or is it garbage?

Code (fw): Select all Collapse
"qâZTIPOC
RAZAOCdCNPJCIECIMCENDERECOCPTELEFONECRESPONSAC(LAUDOCECFCPREVENDACDAVNAOFISCCDAVNOECFCGERASINTCIDCLIENTECMARCAC(MODELOCFIRMWARECNRSERIECVOLUMEHDCGTCNRCAIXACINICIODIAC
DESCISSCNOMECMD5CDTMODIFIC
HRMODIFICPRINCIPALCVERSAOC
P¬*C¤A‰$¢T¸A«QªP"VðR!Jô"DÈŸ'@Oª
B%)4nÌ™EÍÔ‘8P‚C‘PA@„d4C,CF_2iÈ ……dÒ‘h ƒ,#–Œ…dÒ‘³Ç.Ü:ièÑ£8pä‘ÃgŒŸ:tK¬]êêªU äJêT.P–YÉEÒ¥XZŠÑóG;p-®´-®´-®´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘,L&rèÁó'=fô9tèá“§9~3fÄ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘$H€&rìéÓGÏ™>xÈ8|àé3ÇŽ:r3fÈ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ìA¨À¹sä’8r˜Á“ÄPŒR¤•#$H!B„É-L€1'päñãǏž3v0vðÙƒ§Éœ83fÀ+HY-Š´P‚q
H¼
ZÔËQ¦"’QJa.\ˆq‚
ʉ˜FB3fÆ•ˆqY"‘#Y‹:xœÁÃäN9zÈɃFO-Š´9P‚q
H–J´¨§Rž0d€L0`ÂÅÈ•Èq"Y1.‰#&¢:xœÁÃäN9zÈÑÓFŽ-Š´9P‚q
JŠ„ä¨L‰°!¬Y±ÆT q‚YŒf°#D²Ä•V˜ˆ:xœÁÃäN9zÈÉóFÎ-®´9"
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 08:30 AM
ADutheil wrote:Bayron,

lExcl is defined earlier in the function

Code (fw): Select all Collapse
lExcl  := if(cExcl   == NIL .or. cExcl == "", .f., .t.)


I noticed he is passing 7 params to the function while it´s expecting only 6 but that should not make any difference.

Code (fw): Select all Collapse
!NET_USESUB(SZero(pCodCli,5), , ,"INFOPAF", , ,.T.)//NET_USESUB(cFile, cIndex, cExcl, cAlias, lNovaArea, cSub)

The last parameter I removed when I post on the forum because it does not influence anything, this parameter is only used because of a directive of another project that leverages the same PRG.

Algo como:
Code (fw): Select all Collapse
NET_USESUB(SZero(pCodCli,5), , ,"INFOPAF", , ,.T.)

Function NET_USESUB(cFile, cIndex, cExcl, cAlias, lNovaArea, cSub, lParametro)

#IFDEF __OUTROPROJETO__
   If lParametro
     //-- Outros tratamentos
   End
#ENDIF




ADutheil wrote:Samir,
Is the value of local 1 from function VERIFICAARQUIVOAUXILIAR expected or is it garbage?

Code (fw): Select all Collapse
"qâZTIPOC
RAZAOCdCNPJCIECIMCENDERECOCPTELEFONECRESPONSAC(LAUDOCECFCPREVENDACDAVNAOFISCCDAVNOECFCGERASINTCIDCLIENTECMARCAC(MODELOCFIRMWARECNRSERIECVOLUMEHDCGTCNRCAIXACINICIODIAC
DESCISSCNOMECMD5CDTMODIFIC
HRMODIFICPRINCIPALCVERSAOC
P¬*C¤A‰$¢T¸A«QªP"VðR!Jô"DÈŸ'@Oª
B%)4nÌ™EÍÔ‘8P‚C‘PA@„d4C,CF_2iÈ ……dÒ‘h ƒ,#–Œ…dÒ‘³Ç.Ü:ièÑ£8pä‘ÃgŒŸ:tK¬]êêªU äJêT.P–YÉEÒ¥XZŠÑóG;p-®´-®´-®´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘,L&rèÁó'=fô9tèá“§9~3fÄ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘$H€&rìéÓGÏ™>xÈ8|àé3ÇŽ:r3fÈ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ìA¨À¹sä’8r˜Á“ÄPŒR¤•#$H!B„É-L€1'päñãǏž3v0vðÙƒ§Éœ83fÀ+HY-Š´P‚q
H¼
ZÔËQ¦"’QJa.\ˆq‚
ʉ˜FB3fÆ•ˆqY"‘#Y‹:xœÁÃäN9zÈɃFO-Š´9P‚q
H–J´¨§Rž0d€L0`ÂÅÈ•Èq"Y1.‰#&¢:xœÁÃäN9zÈÑÓFŽ-Š´9P‚q
JŠ„ä¨L‰°!¬Y±ÆT q‚YŒf°#D²Ä•V˜ˆ:xœÁÃäN9zÈÉóFÎ-®´9"


I use MemoRead in the file to be able to identify whether it is a TXT or DBF. In this case is a DBF, then it is expected to show trash-like information.
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 03:06 PM
Well, where is lExcl comming from???


This is what I am saying:
lExcl is coming from cExcl, which is forced to be exclusive or shared without verificating if the database is already open by another user...

From earlier post, you stated that you are using the database in a network, which makes me think there are more than one user...

When you open the database, you force it to open the way you want, without knowing if it is used:
Code (fw): Select all Collapse
      if lExcl  //You forced it to open in Exclusive mode without knowing if it's open by some one else... If it is, you will get an error...
         if cAlias == NIL
            use (cTeste) exclusive
         else
            use (cTeste) alias (cAlias) exclusive
         end
      else   //If not Exclusive, you open in Shared mode... But if it is open by someone else in exclusive mode, you will get an error...
         if cAlias == NIL
            use (cTeste)
         else
            use (cTeste) alias (cAlias)
         end
      end
//This is the reason that you only get error in some situations and not all the time...


I think this should be the problem...
I see that you only try to open the auxiliary database in Exclusive mode...

Use:
TRY
CATCH

Or verify if the database is already open by someone else...(I can't help you with that)

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 04:49 PM
Bayron wrote:
Well, where is lExcl comming from???


This is what I am saying:
lExcl is coming from cExcl, which is forced to be exclusive or shared without verificating if the database is already open by another user...

From earlier post, you stated that you are using the database in a network, which makes me think there are more than one user...

When you open the database, you force it to open the way you want, without knowing if it is used:
Code (fw): Select all Collapse
      if lExcl  //You forced it to open in Exclusive mode without knowing if it's open by some one else... If it is, you will get an error...
         if cAlias == NIL
            use (cTeste) exclusive
         else
            use (cTeste) alias (cAlias) exclusive
         end
      else   //If not Exclusive, you open in Shared mode... But if it is open by someone else in exclusive mode, you will get an error...
         if cAlias == NIL
            use (cTeste)
         else
            use (cTeste) alias (cAlias)
         end
      end
//This is the reason that you only get error in some situations and not all the time...


I think this should be the problem...
I see that you only try to open the auxiliary database in Exclusive mode...

Use:
TRY
CATCH

Or verify if the database is already open by someone else...(I can't help you with that)


The file that is open isn't shared ( it's located on C:\RCALOCAL\ )
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 05:04 PM
I am confused:
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
   Size: ********* bytes
   Time from start: 0 hours 0 mins 7 secs 
   Error occurred at: 22/05/2013, 05:24:07
   Error description: Error DBFCDX/1010  Read error: Z:\RCA\ARQAUX.DBF  //<-----------------------


Here is saying something else... ( Read error: Z:\RCA\ARQAUX.DBF  )
Try to use the full path to open the database files...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 05:36 PM
Bayron wrote:I am confused:
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
   Size: ********* bytes
   Time from start: 0 hours 0 mins 7 secs 
   Error occurred at: 22/05/2013, 05:24:07
   Error description: Error DBFCDX/1010  Read error: Z:\RCA\ARQAUX.DBF  //<-----------------------


Here is saying something else... ( Read error: Z:\RCA\ARQAUX.DBF  )
Try to use the full path to open the database files...


Yes, you are right!
I'm sorry, I forgot to update the info.

After some tips I decided to move the file to a local directory and the same error happened again.


Code (fw): Select all Collapse
Application
===========
   Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
   Size: ********* bytes
   Time from start: 0 hours 0 mins 3 secs 
   Error occurred at: 24/05/2013, 05:39:44
   Error description: (DOS Error 38) DBFCDX/1010  Read error: C:\RCALOCAL\03293.DBF

Stack Calls
===========
   Called from:  => DBSKIP(0)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICACAMPOSARQUIVOAUXILIAR(1334)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICAARQUIVOAUXILIAR(208)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => OBTEMINFOAUXILIAR(845)


//------------------------------------------------------------------------------------------------------------------------------------//

Application
===========
   Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
   Size: ********* bytes
   Time from start: 0 hours 0 mins 5 secs 
   Error occurred at: 24/05/2013, 05:43:24
   Error description: Error DBFCDX/1010  Read error: C:\RCALOCAL\ARQAUX.DBF

Stack Calls
===========
   Called from:  => DBCREATE(0)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => CRIAARQUIVOAUXILIAR(249)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => (b)VERIFICAARQUIVOAUXILIAR(54)
   Called from: G:\FWH(10.6)\source\function\msgrun.prg => (b)MSGRUN(145)
   Called from: G:\FWH(10.6)\source\classes\dialog.prg => (b)TDIALOG:TDIALOG(86)
   Called from:  => TDIALOG:DISPLAY(0)
   Called from: G:\FWH(10.6)\source\classes\dialog.prg => TDIALOG:HANDLEEVENT(948)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: G:\FWH(10.6)\source\classes\dialog.prg => TDIALOG:ACTIVATE(280)
   Called from: G:\FWH(10.6)\source\function\msgrun.prg => MSGRUN(151)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICAARQUIVOAUXILIAR(54)
   Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => OBTEMINFOAUXILIAR(845)
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 05:57 PM
Samir

I noticed that you have linked into your program from the error.log DBFCDX,DBFFPT and I am sure somewhere at the top of your program you have defined ..
Code (fw): Select all Collapse
REQUEST DBFCDX
rddsetdefault ( "DBFCDX" )


Also ( and some people may argue with me ) .. when I open a .dbf I specify it with the clause
Code (fw): Select all Collapse
via "DBFCDX"

Here is my Netuse() function that works quite well for me .. not as sophisticated as yours but perhaps you can review and consider how I am opening a dbf.

Also as mentioned earlier .. I get the default location of the .exe and then make sure I SET DEFA to the .exe location .. and it does not matter if the path comes from a UNC or a mapped drive letter.
Code (fw): Select all Collapse
//-- get timestamp on .exe //

cFILE := GetModuleFileName( GetInstance() )
aDIR  := DIRECTORY( cFILE )
dEXE  := aDIR[1] [3]

// where .exe started from is default directory //

nSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,nSTART-1)

aDIR   := NIL

SET DEFA to ( cDEFA )


Code (fw): Select all Collapse
//------------------------------
Func NETUSE( CDATABASE, LOPENMODE, NSECONDS )

LOCAL FOREVER, RESTART, WAIT_TIME, YESNO

RESTART := .T.
FOREVER := ( NSECONDS := 0 )
YESNO   := {"Yes" , "No"}

DO WHILE RESTART

   WAIT_TIME := NSECONDS

   DO WHILE ( FOREVER .OR. WAIT_TIME > 0 )

      IF LOPENMODE
         USE ( CDATABASE ) via "DBFCDX" EXCLUSIVE
      ELSE
         USE ( CDATABASE ) via "DBFCDX" SHARED
      ENDIF

      IF .NOT. NETERR()
         RETURN(.T.)
      ENDIF
      INKEY(1)
      WAIT_TIME--

   ENDDO

   * lock failed, ask to continue

   IF MsgYesNo( "Cannot lock " + CDATABASE + ", retry ?" )
   ELSE
      EXIT
   ENDIF

ENDDO

RETURN(.F.)


If Netuse( cDefa+"\Table.Dbf",.f.,5)

cDefa is the .exe location .. can be a logical drive or UNC G:\Folder or \\server\volume\Folder
First logical is Shared or Exclusive and the last parameter is the TimeOut before error.

Don't know if any of this will help..

Rick Lipkin
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Error DBFCDX/1010 Read error
Posted: Fri May 24, 2013 07:12 PM

I open hundreds of files with this function in hundreds of clients every day!
I think that the error is somewhere else, some kind of virus or another odd error...

The error is intermitent (only on the first run of the day, if I recover a copy of the exe the error ceases), happens only in this client, changing the file from server to a local address doesn't change the error.

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2