Alaska Software Inc. - DBFs w/ FPT files Open Failure
Username: Password:
AuthorTopic: DBFs w/ FPT files Open Failure
Al WimberlyDBFs w/ FPT files Open Failure
on Fri, 02 Apr 2010 13:17:37 -0400
The following opens DBF files with or without a CDX index files, but will 
not open a DBF with an associated FPT file

USE (cFullName) ALIAS (cAlias) SHARED NEW

I used DbeLoad("CDXDBE", .T.) to set the data file environment.

Still learning.

Thanks

Al Wimberly
Pablo BotellaRe: DBFs w/ FPT files Open Failure
on Fri, 02 Apr 2010 22:06:22 +0200
Hi,
try to use this dbesys
proc dbeSys()
DbeLoad( "FOXDBE",.T.)
DbeLoad( "CDXDBE",.T.)
DbeBuild( "SIXCDX", "FOXDBE", "CDXDBE" )
return

Also you may need to add some config params using DbeInfo() and choose the right collation and codepage

Regards,
Pablo Botella
Pablo BotellaRe: DBFs w/ FPT files Open Failure
on Fri, 02 Apr 2010 22:11:36 +0200
> I used DbeLoad("CDXDBE", .T.) to set the data file environment.
In Xbase++ data and index components are loaded by separate
and finally you build your Dbe using 1 previously loaded data component and 1 previously loaded index component

CDXDBE is only a index component not a data component
Al WimberlyRe: DBFs w/ FPT files Open Failure
on Sat, 03 Apr 2010 10:42:50 -0400
Thanks to Pablo, all my DBF files are now opening. However, it appears the 
associated CDX files are not opening automatically with the DBF. The CDX tag 
order stays at zero and dbSetOrder() has no effect.

What am I missing?


<Al Wimberly> wrote in message 
news:3aff2158$1e1e8a38$5b76e@news.alaska-software.com...
> The following opens DBF files with or without a CDX index files, but will 
> not open a DBF with an associated FPT file
>
> USE (cFullName) ALIAS (cAlias) SHARED NEW
>
> I used DbeLoad("CDXDBE", .T.) to set the data file environment.
>
> Still learning.
>
> Thanks
>
> Al Wimberly
>
>
>
>
Pablo BotellaRe: DBFs w/ FPT files Open Failure
on Sat, 03 Apr 2010 21:30:37 +0200
Hi,
>However, it appears the 
> associated CDX files are not opening automatically with the DBF.
Yes Xbase++ have not auto-open index, but the workarround is easy

I've used in this sample ot4xb.dll for easy codding you can download from my site www.xbwin.com or rewrite in pure Xbase++ 

   In a separate PRG -----------------------
#include "ot4xb.ch"
function MyDbUseArea()
local np := PCount()
local ap := Array(np)
local n,cIndex
for n := 1 to np
   ap[n] := PValue(n)
next
if lCallFuncPA("DbUseArea",ap)
   cIndex := cPathChangeExt(ap[3])
   if File( cIndex)
      OrdListAdd( cIndex ) 
   end
end
return NIL
 ----------------------------------------------------------

in your existing PRGs
#pragma map( DbUseArea, "MYDBUSEAREA" ) 

Regards,
Pablo Botella
Al WimberlyRe: DBFs w/ FPT files Open Failure
on Sat, 03 Apr 2010 16:40:14 -0400
Thanks Pablo, but I am not looking for workarounds or 3rd party solutions at 
this point.

After a USE commnad, there must be simple, Xbase procedures for (1) opening 
an associated CDX file and then (2) selecting a TAG order from within that 
CDX file.

My CDX files were made under the SIXCDX RDD. Is that a problem?

I've been trying to find a straight forward explanation in the docs as to 
how to do the above, but my glasses must be foggy.

Help if you can.

Thanks
Al WimberlyRe: DBFs w/ FPT files Open Failure
on Sun, 04 Apr 2010 12:07:00 -0400
Oops! I think I sounded ungrateful in my response to you Pablo -- I 
apologize. Your routine worked fine and I am now able to open the CDX files 
and select their tags normally. I did add one thing to make it work 
properly:

cIndex := cPathChangeExt(ap[3]) + '.CDX'

In the longer term, I hope to keep the app as "clean" as possible, using as 
few non-Alaska or 3rd party pieces as possible was what I was lamely trying 
to say.

Your help has been extraordinary and I am grateful.

Al Wimberly

"Pablo Botella" <pb_no_spam_@_remove_all_betwen_underscores_xbwin.com> wrote 
in message news:2d5fdb0f$650e0e70$5c3d2@news.alaska-software.com...
> Hi,
>>However, it appears the
>> associated CDX files are not opening automatically with the DBF.
> Yes Xbase++ have not auto-open index, but the workarround is easy
>
> I've used in this sample ot4xb.dll for easy codding you can download from 
> my site www.xbwin.com or rewrite in pure Xbase++
>
>    In a separate PRG -----------------------
> #include "ot4xb.ch"
> function MyDbUseArea()
> local np := PCount()
> local ap := Array(np)
> local n,cIndex
> for n := 1 to np
>   ap[n] := PValue(n)
> next
> if lCallFuncPA("DbUseArea",ap)
>   cIndex := cPathChangeExt(ap[3])
>   if File( cIndex)
>      OrdListAdd( cIndex )
>   end
> end
> return NIL
>  ----------------------------------------------------------
>
> in your existing PRGs
> #pragma map( DbUseArea, "MYDBUSEAREA" )
>
> Regards,
> Pablo Botella
>
>
>
Pablo BotellaRe: DBFs w/ FPT files Open Failure
on Sun, 04 Apr 2010 23:41:36 +0200
Hi,

> cIndex := cPathChangeExt(ap[3])
opps this was my fault 
must be
cPathChangeExt(ap[3], ".cdx")

I was using ot4xb functions here to avoid rewrite stuff that have already, but as the behavior is obvious you can replace it with your own stuff. About lCallFuncPA() is usefull to provide the same number of params, but this time you can simply declare the params and pass all to DbUseArea() directly.

function MyDbUseArea(p1,p2,p3,p4,p5,p6)
local cIndex
DbUseArea(p1,p2,p3,p4,p5,p6)
cIndex := cPathChangeExt(p3) 
 or your own function that change the extension 
if File( cIndex)
   OrdListAdd( cIndex ) 
end
return NIL

The #pragma map( DbUseArea, "MYDBUSEAREA" ) at the begining of the other PRGs avoid you the need to review the existing code for a fast Clipper/Xbase++ migration.

Regards,
Pablo
Pablo BotellaRe: DBFs w/ FPT files Open Failure
on Mon, 05 Apr 2010 00:59:23 +0200
arrrggggg
> cIndex := cPathChangeExt(p3) 
I'm comdenated to forget the second parameter of this function all the times  
cIndex := cPathChangeExt(p3, ".cdx")
AUGE_OHRRe: DBFs w/ FPT files Open Failure
on Mon, 05 Apr 2010 02:09:42 +0200
hi,

> In the longer term, I hope to keep the app as "clean" as possible, using 
> as few non-Alaska or 3rd party pieces as possible was what I was lamely 
> trying to say.

#IFDEF __XPP__
      use Xbase++ Code
#ELSE
     use Cl*pper Code
#ENDIF

Constante __XPP__ (2x Underline "_"+"XPP"+2x Underline "_") is "build-in" 
Xbase++

greetings by OHR
Jimmy