Alaska Software Inc. - Unknown function while skipping through dbf file
Username: Password:
AuthorTopic: Unknown function while skipping through dbf file
Thomas Braun
Unknown function while skipping through dbf file
on Sat, 20 Jun 2009 15:17:45 +0200
Hi,

I'm currently struggling with an error I can't resolve.

Consider the following loop:

SELECT SUPPDATA
OrdsetFocus(0)
GO TOP
DO WHILE ! EOF()
   SELECT SUPPBASE2
   IF dbseek( PADR(SUPPDATA->suptext,50) ,.F.,"DISPLAY")
      SELECT SUPPDATA
      IF RecLock(5)
         REPLACE suppitemid WITH SUPPBASE2->itemid
         dbrunlock()
         dbcommit()
      ENDIF
   ENDIF
   SELECT SUPPDATA
   SKIP
ENDDO

Th index "DISPLAY" looks like this:

OrdCreate( cPath + "\SUPPBASE2.CDX", "DISPLAY", "PADR(DISPLAY,50)" )

...DISPLAY is a memo field.

I can't see anything special, but on every run I get error messages similar
to this:

------------------------------------------------------------------------------
FEHLERPROTOKOLL von "D:\wwwroot\hp\test.exe" Datum: 06/20/2009 15:09:28

Xbase++ Version     : Xbase++ (R) Version 1.82.294
Betriebssystem      : Windows XP 05.01 Build 02600 Service Pack 3
------------------------------------------------------------------------------
oError:args         :
oError:canDefault   : J
oError:canRetry     : N
oError:canSubstitute: N
oError:cargo        : NIL
oError:description  : Betriebsystemfehler
oError:filename     : 
oError:genCode      :         40
oError:operation    : DbRUnlock
oError:osCode       :          1
oError:severity     :          2
oError:subCode      :          4
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von COPYOTHERLISTDATA(581)
Aufgerufen von MIGRATESUPPDATA(461)
Aufgerufen von MAIN(101)

What is very weird is the fact that the error does not occur consinstently
at the same line nor at the same record of the database. 

Sometimes it crashes at dbrunlock(), sometimes on SKIP, sometimes on
dbcommit()

What is also not displayed in the error log is the wording "illegal
function" which is only shown in the message box.

Any ideas on how to resolve this are welcome....

I already tried exclusive opening of the database, deleting and recreating
the index several times... so currently I'm lost.

regards
Thomas
Joe Carrick Re: Unknown function while skipping through dbf file
on Sat, 20 Jun 2009 07:11:33 -0700
Hi Thomas,

In my experience this type of error is a phantom.  What really seems to 
be happening is that some extraneous operation (usually a DLL called 
with a bad parameter) has "stomped" on the memory.  Another possibility 
is a bad sector on the hard drive that's not mapped and is randomly 
written.  If that's the problem you can try a defrag.  If it's the first 
case then you'll just have a tough time finding the culprit - it could 
even be a worm or a virus.

Good Luck, Joe

Thomas Braun wrote:
> Hi,
>
> I'm currently struggling with an error I can't resolve.
>
> Consider the following loop:
>
> SELECT SUPPDATA
> OrdsetFocus(0)
> GO TOP
> DO WHILE ! EOF()
>    SELECT SUPPBASE2
>    IF dbseek( PADR(SUPPDATA->suptext,50) ,.F.,"DISPLAY")
>       SELECT SUPPDATA
>       IF RecLock(5)
>          REPLACE suppitemid WITH SUPPBASE2->itemid
>          dbrunlock()
>          dbcommit()
>       ENDIF
>    ENDIF
>    SELECT SUPPDATA
>    SKIP
> ENDDO
>
> Th index "DISPLAY" looks like this:
>
> OrdCreate( cPath + "\SUPPBASE2.CDX", "DISPLAY", "PADR(DISPLAY,50)" )
>
> ...DISPLAY is a memo field.
>
> I can't see anything special, but on every run I get error messages similar
> to this:
>
> ------------------------------------------------------------------------------
> FEHLERPROTOKOLL von "D:\wwwroot\hp\test.exe" Datum: 06/20/2009 15:09:28
>
> Xbase++ Version     : Xbase++ (R) Version 1.82.294
> Betriebssystem      : Windows XP 05.01 Build 02600 Service Pack 3
> ------------------------------------------------------------------------------
> oError:args         :
> oError:canDefault   : J
> oError:canRetry     : N
> oError:canSubstitute: N
> oError:cargo        : NIL
> oError:description  : Betriebsystemfehler
> oError:filename     : 
> oError:genCode      :         40
> oError:operation    : DbRUnlock
> oError:osCode       :          1
> oError:severity     :          2
> oError:subCode      :          4
> oError:subSystem    : BASE
> oError:thread       :          1
> oError:tries        :          0
> ------------------------------------------------------------------------------
> CALLSTACK:
> ------------------------------------------------------------------------------
> Aufgerufen von COPYOTHERLISTDATA(581)
> Aufgerufen von MIGRATESUPPDATA(461)
> Aufgerufen von MAIN(101)
>
> What is very weird is the fact that the error does not occur consinstently
> at the same line nor at the same record of the database. 
>
> Sometimes it crashes at dbrunlock(), sometimes on SKIP, sometimes on
> dbcommit()
>
> What is also not displayed in the error log is the wording "illegal
> function" which is only shown in the message box.
>
> Any ideas on how to resolve this are welcome....
>
> I already tried exclusive opening of the database, deleting and recreating
> the index several times... so currently I'm lost.
>
> regards
> Thomas
>
Thomas Braun
Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 09:22:15 +0200
Joe Carrick wrote:

> Hi Thomas,
> 
> In my experience this type of error is a phantom.  What really seems to 
> be happening is that some extraneous operation (usually a DLL called 
> with a bad parameter) has "stomped" on the memory.  Another possibility 
> is a bad sector on the hard drive that's not mapped and is randomly 
> written.  If that's the problem you can try a defrag.  If it's the first 
> case then you'll just have a tough time finding the culprit - it could 
> even be a worm or a virus.
> 
> Good Luck, Joe

Thanks  

First thing I will try is to run it on a different machine to see what
happens then...

thomas
AUGE_OHRRe: Unknown function while skipping through dbf file
on Sat, 20 Jun 2009 17:17:36 +0200
hi,

>      IF RecLock(5)

is this a db"R"Lock() ?

>         REPLACE suppitemid WITH SUPPBASE2->itemid
>         dbrunlock()

while you use a db"R"unlock()

try to use RECNO() with dbRLock(nRec) and dbRUnlock(nRec)

greetings by OHR
Jimmy
Clayton JonesRe: Unknown function while skipping through dbf file
on Sat, 20 Jun 2009 21:15:34 -0400
Jimmy,

>>      IF RecLock(5)
>
>is this a db"R"Lock() ?
>
>>         REPLACE suppitemid WITH SUPPBASE2->itemid
>>         dbrunlock()
>
>while you use a db"R"unlock()

I don't think this is an issue.  The Xpp docs say

 "If no record ID is specified, DbRUnlock() behaves like DbUnlock()"

...and

 "If no record ID is specified, DbRLock() behaves like RLock()"




Regards,
Clayton

Clayton Jones   www.cjcom.net 
 Top-Down Library for Xbase++
 X-DBU Database Utility   
 X-MEMO Memo Field Replacement
AUGE_OHRRe: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 04:26:36 +0200
hi,

> I don't think this is an issue.  The Xpp docs say

it just was i Idee if DbRlock(nRec) is same Recno() as DbrUnlock(nRec)

> Xbase++ Version     : Xbase++ (R) Version 1.82.294
@Thomas it is a "old" Version ...

DBEDBE or FOXDBE ?
DBFNTX  or DBFCDX ?
while often DBESYS make such DBF Error, please show it to us.

greetings by OHR
Jimmy
Thomas Braun
Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 09:26:40 +0200
AUGE_OHR wrote:

>> Xbase++ Version     : Xbase++ (R) Version 1.82.294
> @Thomas it is a "old" Version ...
> 
> DBEDBE or FOXDBE ?

FOXCDX

> DBFNTX  or DBFCDX ?
> while often DBESYS make such DBF Error, please show it to us.

Don't think this makes any sense - all of those "basics" are unchanged for
years.

thomas
Frans Vermeulen Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 09:52:15 +0200
Thomas,

-a little prejudiced after reading the thread
"Frequent error while open file" in the data-access
newsgroup- : Have you checked your dbeInfo settings ?
(Jack's basics had also not been changed for years...)

BTW. the dbCommit() is redundant, so it should not
throw an error at all. That, and the error during skip
indicate a problem with the locking of the index file.

HTH,
Frans Vermeulen


> AUGE_OHR wrote:
> 
> >> Xbase++ Version     : Xbase++ (R) Version 1.82.294
> > @Thomas it is a "old" Version ...
> > 
> > DBEDBE or FOXDBE ?
> 
> FOXCDX
> 
> > DBFNTX  or DBFCDX ?
> > while often DBESYS make such DBF Error, please show it to us.
> 
> Don't think this makes any sense - all of those "basics" are unchanged for
> years.
> 
> thomas
Thomas Braun
Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 11:51:26 +0200
Frans Vermeulen wrote:

> -a little prejudiced after reading the thread
> "Frequent error while open file" in the data-access
> newsgroup- : Have you checked your dbeInfo settings ?

Actually, I do not have any special dbeInfo settings in place, everything
is "default"

So dbesys() is just loading the DBEs.

I suspected a difference between exclusive and shared mode, but channging
the code did not cure the problem.

> BTW. the dbCommit() is redundant, so it should not
> throw an error at all. That, and the error during skip
> indicate a problem with the locking of the index file.

Now, after a lot of wasted time and quite a bit of shoving code around,
it suddenly started to work as expected. 

I do not know exactly what fixed this but I suspect some kind of damage of
the dbf file, because I also copied the file via dbu.

sigh 
back to work....
thomas
AUGE_OHRRe: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 18:54:54 +0200
hi,

>>> Xbase++ Version     : Xbase++ (R) Version 1.82.294
>> @Thomas it is a "old" Version ...
>>
>> DBEDBE or FOXDBE ?
> FOXCDX

i think i found a PDR for 1.8.294 ...

>> while often DBESYS make such DBF Error, please show it to us.
>
> Don't think this makes any sense - all of those "basics" are unchanged for
> years.

sorry NO, you are working with a v1.8x Version where _DELAY is much to short 
for those
"exessive" Database moving. Please look into v1.8x Help File what "default" 
they have and compare
it with v1.9x which is 100x time bigger than v1.8x

greetings by OHR
Jimmy
Thomas Braun
Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 09:24:47 +0200
AUGE_OHR wrote:

> hi,
> 
>>      IF RecLock(5)
> 
> is this a db"R"Lock() ?

No - it is a rlock(), but I'm using this RecLock() function for ages.

> 
>>         REPLACE suppitemid WITH SUPPBASE2->itemid
>>         dbrunlock()
> 
> while you use a db"R"unlock()
> 
> try to use RECNO() with dbRLock(nRec) and dbRUnlock(nRec)

ok - I'll try this as well

thanks
thomas
Jorge LRe: Unknown function while skipping through dbf file
on Sun, 21 Jun 2009 19:45:13 -0300
Hi

This type of mistakes happens to me occasionally, but I am attributing it to 
mistakes in the network ( cable, NIC, conectors,  etc )

i have a question :
this process fail localy or in a network environment ?

but....
i make a little change to your code

DO WHILE ( SUPPDATA->( ! EOF() ) )
      IF SUPPBASE2->( dbseek( PADR(SUPPDATA->suptext,50) ,.F.,"DISPLAY") )
          IF SUPPDATA->( RecLock(5)  )    --->  reclock() = rlock()  not 
dbrlock !
              REPLACE SUPPDATA->suppitemid WITH SUPPBASE2->itemid
             /// dbrunlock()        next rlock() relase the previus lock
             /// dbcommit()        dbskip() perform dbcommit  command
           ENDIF
      ENDIF
      SUPPDATA->( dbSKIP() )
 ENDDO
 SUPPDATA->( dbunlock() )

Regards


"Thomas Braun" <spam@software-braun.de> escribió en el mensaje de noticias 
news:1kcpw2qqvobtm.1vafarbw0a4xm.dlg@40tude.net...
> Hi,
>
> I'm currently struggling with an error I can't resolve.
>
> Consider the following loop:
>
> SELECT SUPPDATA
> OrdsetFocus(0)
> GO TOP
> DO WHILE ! EOF()
>   SELECT SUPPBASE2
>   IF dbseek( PADR(SUPPDATA->suptext,50) ,.F.,"DISPLAY")
>      SELECT SUPPDATA
>      IF RecLock(5)
>         REPLACE suppitemid WITH SUPPBASE2->itemid
>         dbrunlock()
>         dbcommit()
>      ENDIF
>   ENDIF
>   SELECT SUPPDATA
>   SKIP
> ENDDO
>
> Th index "DISPLAY" looks like this:
>
> OrdCreate( cPath + "\SUPPBASE2.CDX", "DISPLAY", "PADR(DISPLAY,50)" )
>
> ...DISPLAY is a memo field.
>
> I can't see anything special, but on every run I get error messages 
> similar
> to this:
>
> ------------------------------------------------------------------------------
> FEHLERPROTOKOLL von "D:\wwwroot\hp\test.exe" Datum: 06/20/2009 15:09:28
>
> Xbase++ Version     : Xbase++ (R) Version 1.82.294
> Betriebssystem      : Windows XP 05.01 Build 02600 Service Pack 3
> ------------------------------------------------------------------------------
> oError:args         :
> oError:canDefault   : J
> oError:canRetry     : N
> oError:canSubstitute: N
> oError:cargo        : NIL
> oError:description  : Betriebsystemfehler
> oError:filename     :
> oError:genCode      :         40
> oError:operation    : DbRUnlock
> oError:osCode       :          1
> oError:severity     :          2
> oError:subCode      :          4
> oError:subSystem    : BASE
> oError:thread       :          1
> oError:tries        :          0
> ------------------------------------------------------------------------------
> CALLSTACK:
> ------------------------------------------------------------------------------
> Aufgerufen von COPYOTHERLISTDATA(581)
> Aufgerufen von MIGRATESUPPDATA(461)
> Aufgerufen von MAIN(101)
>
> What is very weird is the fact that the error does not occur consinstently
> at the same line nor at the same record of the database.
>
> Sometimes it crashes at dbrunlock(), sometimes on SKIP, sometimes on
> dbcommit()
>
> What is also not displayed in the error log is the wording "illegal
> function" which is only shown in the message box.
>
> Any ideas on how to resolve this are welcome....
>
> I already tried exclusive opening of the database, deleting and recreating
> the index several times... so currently I'm lost.
>
> regards
> Thomas
>
Thomas Braun
Re: Unknown function while skipping through dbf file
on Mon, 22 Jun 2009 10:04:15 +0200
Jorge L wrote:

> This type of mistakes happens to me occasionally, but I am attributing it to 
> mistakes in the network ( cable, NIC, conectors,  etc )
> 
> i have a question :
> this process fail localy or in a network environment ?

Local disk - no network.

> but....
> i make a little change to your code
[...]

Thanks for the suggestion - it is currently running and until now I got no
more error.

More than weird...

Thomas