Alaska Software Inc. - Clipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
Username: Password:
AuthorTopic: Clipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
Richard PulliamClipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
on Sun, 05 Jan 2020 18:48:13 -0600
Is there an equivalent to Clipper 5.2e function __DBSDF() in xBase++ 1.9?

I am converting a Clipper app that uses __DBSDF() to export a DBF to an 
SDF file.

Maybe DBExport()?

I have to be able to do this for sure, and hopefully, with the same 
output.  __DBSDF() does not compile in xBase++ 1.9.

Thanks.

Richard@ClipperSolutions.com
Andreas Gehrs-Pahl
Re: Clipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
on Sun, 05 Jan 2020 21:24:33 -0500
Richard,

>Is there an equivalent to Clipper 5.2e function __DBSDF() in xBase++ 1.9?
>Maybe DBExport()?

Yes, you can use DbExport() -- as well as DbImport() -- instead of the 
Clipper function __DBSDF(). The only real difference is the first parameter 
of __DBSDF(), which determines if you import or export records.

The last two parameters of DbExport() and DbImport() determine the DBE and 
any DBE-specific settings that should be used.

All other parameters are identical between those functions, even their 
order.

So you could make your own replacement __DBSDF() function, like this:

Function __DBSDF(lExport, cFile, aFields, bFor, bWhile, nCount, nRecord, ; 
                 lRest, aDbeInfo)
LOCAL aDBEs := DbeList()
LOCAL cDBE  := "SDFDBE"
LOCAL nDBE  := AScan(aDBEs, {|a| cDBE == a[1] .and. .not. a[2]})

*  Default aDbeInfo to {{SDFDBE_DECIMAL_TOKEN, "."}, ;
*                       {SDFDBE_LOGICAL_TOKEN, "TF"}, ;
*                       {SDFDBE_STRUCTURE_EXT, "TXT"}}

   if nDBE == 0
      DbeLoad(cDBE, .f.)
   endif

   if lExport
      DbExport(cFile, aFields, bFor, bWhile, nCount, nRecord, lRest, ; 
               cDBE, aDbeInfo)
   else
      DbImport(cFile, aFields, bFor, bWhile, nCount, nRecord, lRest, ;
               cDBE, aDbeInfo)
   endif
return (NIL)

The aDbeInfo value can be omitted, if the settings aren't changed, as 
they are the actual DBE default values.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Richard PulliamRe: Clipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
on Mon, 06 Jan 2020 16:17:01 -0600
On 1/5/2020 8:24 PM, Andreas Gehrs-Pahl wrote:
> Richard,
> 
>> Is there an equivalent to Clipper 5.2e function __DBSDF() in xBase++ 1.9?
>> Maybe DBExport()?
> 
> Yes, you can use DbExport() -- as well as DbImport() -- instead of the
> Clipper function __DBSDF(). The only real difference is the first parameter
> of __DBSDF(), which determines if you import or export records.
> 
> The last two parameters of DbExport() and DbImport() determine the DBE and
> any DBE-specific settings that should be used.
> 
> All other parameters are identical between those functions, even their
> order.
> 
> So you could make your own replacement __DBSDF() function, like this:
> 
> Function __DBSDF(lExport, cFile, aFields, bFor, bWhile, nCount, nRecord, ;
>                   lRest, aDbeInfo)
> LOCAL aDBEs := DbeList()
> LOCAL cDBE  := "SDFDBE"
> LOCAL nDBE  := AScan(aDBEs, {|a| cDBE == a[1] .and. .not. a[2]})
> 
> *  Default aDbeInfo to {{SDFDBE_DECIMAL_TOKEN, "."}, ;
> *                       {SDFDBE_LOGICAL_TOKEN, "TF"}, ;
> *                       {SDFDBE_STRUCTURE_EXT, "TXT"}}
> 
>     if nDBE == 0
>        DbeLoad(cDBE, .f.)
>     endif
> 
>     if lExport
>        DbExport(cFile, aFields, bFor, bWhile, nCount, nRecord, lRest, ;
>                 cDBE, aDbeInfo)
>     else
>        DbImport(cFile, aFields, bFor, bWhile, nCount, nRecord, lRest, ;
>                 cDBE, aDbeInfo)
>     endif
> return (NIL)
> 
> The aDbeInfo value can be omitted, if the settings aren't changed, as
> they are the actual DBE default values.
> 
> Hope that helps,
> 
> Andreas
> 

Thanks. Will use dbexport(). K.I.S.S.

Richard
Andreas Gehrs-Pahl
Re: Clipper 5.2e __DBSDF() equivalent in Alaska xBase++ 1.9
on Mon, 06 Jan 2020 22:11:53 -0500
Richard,

>Thanks. Will use dbexport(). K.I.S.S.

Or you could simply add that function to your code, so you don't have to 
make any other code changes at all. K.I.even.more.S.S

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC