Problem setting index (Bug?)

  • Follow


I have a question.  I am working with an old application keeping indexes
and datafiles in two different locations, and I'm converting it, but I
have a problem.

Here is reduced code that produces the error:

Function Main()

   USE "..\xHarb\Data\DATADICT.DBF" ALIAS "MyJunk" SHARED NEW READONLY
VIA "DBFCDX"
   MyJunk->( DBSETINDEX("..\xHarb\Index\DATADICT.CDX"))
   MyJunk->( OrdSetFocus( 1 ))
   BROWSE()
   MyJunk->(DbCloseArea())
   Return

And here is the error.

Error BASE/1002  Alias does not exist: DATADICT Arguments: ()

Error at ...: ORDLISTADD(0) in Module:
Called from : DBSETINDEX(64) in Module: \xHarbour\source\rdd\rddord.prg
Called from : MAIN(18) in Module: john.prg

Unrecoverable error 9104: hb_cdxIndexFree: index file still locked.
Called from __QUIT(0)
Called from DEFERROR(209)
Called from ERRORSYS(0)
Called from ORDLISTADD(0)
Called from DBSETINDEX(64)
Called from MAIN(18)

There should not be an alias "DataDict" since I have named my alias
"MyJunk."  I can tell you that if I don't attempt to use the ALIAS part
of the USE statement, it will work if I also change the "MyJunk"
references to "DataDict."

Can anyone help?

John Moore
Atlanta, GA
0
Reply John 2/1/2010 10:33:50 PM

Dear John Moore:

On Feb 1, 3:33=A0pm, John Moore <john.moore...@att.net> wrote:
....
> Here is reduced code that produces the error:

Assumed:
REQUEST DBFCDX

> Function Main()
>
> =A0 =A0USE "..\xHarb\Data\DATADICT.DBF" ALIAS "MyJunk" SHARED NEW READONL=
Y
> VIA "DBFCDX"

From the online docs:
ALIAS <cAlias>
This is the symbolic alias name of the work area. It can be specified
as a literal alias name or a character expression enclosed in
parentheses. It defaults to the file name of <cDatabase> without
extension.

So either:
.... ALIAS MyJunk ...
..OR.
.... ALIAS ("MyJunk") ...

David A. Smith
0
Reply dlzc 2/1/2010 11:05:01 PM


Hi

Are you sure that your index file was not created with

index on  datadict->fieldname tag T000 // note an alias on front of
field

if yes, it correct to give the error, since the index expect that the
open areas have the datadict as alias

Regards
Luiz

On 1 fev, 20:33, John Moore <john.moore...@att.net> wrote:
> I have a question. =A0I am working with an old application keeping indexe=
s
> and datafiles in two different locations, and I'm converting it, but I
> have a problem.
>
> Here is reduced code that produces the error:
>
> Function Main()
>
> =A0 =A0USE "..\xHarb\Data\DATADICT.DBF" ALIAS "MyJunk" SHARED NEW READONL=
Y
> VIA "DBFCDX"
> =A0 =A0MyJunk->( DBSETINDEX("..\xHarb\Index\DATADICT.CDX"))
> =A0 =A0MyJunk->( OrdSetFocus( 1 ))
> =A0 =A0BROWSE()
> =A0 =A0MyJunk->(DbCloseArea())
> =A0 =A0Return
>
> And here is the error.
>
> Error BASE/1002 =A0Alias does not exist: DATADICT Arguments: ()
>
> Error at ...: ORDLISTADD(0) in Module:
> Called from : DBSETINDEX(64) in Module: \xHarbour\source\rdd\rddord.prg
> Called from : MAIN(18) in Module: john.prg
>
> Unrecoverable error 9104: hb_cdxIndexFree: index file still locked.
> Called from __QUIT(0)
> Called from DEFERROR(209)
> Called from ERRORSYS(0)
> Called from ORDLISTADD(0)
> Called from DBSETINDEX(64)
> Called from MAIN(18)
>
> There should not be an alias "DataDict" since I have named my alias
> "MyJunk." =A0I can tell you that if I don't attempt to use the ALIAS part
> of the USE statement, it will work if I also change the "MyJunk"
> references to "DataDict."
>
> Can anyone help?
>
> John Moore
> Atlanta, GA

0
Reply culikr 2/2/2010 10:33:14 AM

> 
> So either:
> .... ALIAS MyJunk ...
> ..OR.
> .... ALIAS ("MyJunk") ...
> 
> David A. Smith

Neither changes the behavior.

> Are you sure that your index file was not created with
> index on  datadict->fieldname tag T000 // note an alias on front of field
>
> Luiz

Actually, the index file itself was created under Clipper 5.2 and SIX3,
but I wrote a quick testbed to recreate the index in xHarbour, using the
code:  INDEX ON DBF_NAME+STR(FIELD_NUM) TAG "DBF" TO
"..\xHarb\Index\DATADICT.CDX" ALL ASCENDING VIA DBFCDX.  The problem
went away.  This won't be a problem, since the application has a
"FileManager" utility which I am also porting.  One of its options is to
blow away and recreate index files for all datafiles.

I will need to "reverse" test to be sure that the Clipper app will
behave as expected with the xHarbour CDX files.

Thanks to both for the replies, and the solution!

John Moore
Atlanta, GA
0
Reply John 2/2/2010 2:55:23 PM

Dear John Moore:

On Feb 2, 7:55=A0am, John Moore <john.moore...@att.net> wrote:
> > So either:
> > .... ALIAS MyJunk ...
> > ..OR.
> > .... ALIAS ("MyJunk") ...
>
> Neither changes the behavior.

I wouldn't be that lucky.

> > Are you sure that your index file was not
> > created with index on =A0datadict->fieldname
> >      tag T000 // note an alias on front of field
>
> Actually, the index file itself was created under
> Clipper 5.2 and SIX3, but I wrote a quick testbed
> to recreate the index in xHarbour, using the
> code:
> INDEX ON DBF_NAME+STR(FIELD_NUM) ;
>    TAG "DBF" ;
>    TO "..\xHarb\Index\DATADICT.CDX" ;
>    ALL :
>    ASCENDING ;
>    VIA DBFCDX.
>=A0The problem went away.

It'll be back in Clipper.  Or if there is a "reindex" option in the
Clipper program, you'll get it again.

>=A0This won't be a problem, since the application
> has a "FileManager" utility which I am also
> porting. =A0One of its options is to blow away and
> recreate index files for all datafiles.

So it will be back if you don't kill the Clipper version of this
utility.  Or decide that you can live with the default file alias...

> I will need to "reverse" test to be sure that the
> Clipper app will behave as expected with the
> xHarbour CDX files.

My money is on you getting bit again.

Be sure and select compatible file locking in your xHarbour
application, if both code bases run on the same database at the same
time.  SET DBFLOCKSCHEME woudl be good for you to review, if you don't
know about it already.  These constants are defined:
DB_DBFLOCK_CLIP 1 Clipper 5.2 locking scheme
DB_DBFLOCK_CL53 2 Clipper 5.3 locking scheme
DB_DBFLOCK_CL53EXT 4 Emulated shared locking

David A. Smith
0
Reply dlzc 2/2/2010 3:54:44 PM

4 Replies
585 Views

(page loaded in 0.104 seconds)

Similiar Articles:













7/22/2012 6:37:02 PM


Reply: