__dbOpenSDF keeps giving me errors.

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
HGAutomator
Posts: 200
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

__dbOpenSDF keeps giving me errors.

Post by HGAutomator »

I can't seem to open a tab-delimited file.

Code: Select all

IF !__dbOpenSDF("testlong.txt", aStruct, "DELIM", .T., "TESTLONG", Chr(9))
returns an error:

Error DBCMD/1015 Argument error: __DBOPENSDF
User avatar
serge_girard
Posts: 3412
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: __dbOpenSDF keeps giving me errors.

Post by serge_girard »

Try this way:

IF !__dbOpenSDF("testlong.txt", aStruct)
There's nothing you can do that can't be done...
HGAutomator
Posts: 200
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

Re: __dbOpenSDF keeps giving me errors.

Post by HGAutomator »

Thanks Serge,

I was able to get it working with

xResult := !__dbOpenSDF( "testlong_comma.txt", aStruct, "DELIM", .T., "TESTLONG" )

Unfortunately, I quickly discovered the limitations of delimited RDDs, like not having record counts. We'll probably build a substitute.


T & R,

DC
serge_girard wrote: Sun Jul 19, 2026 6:34 am Try this way:

IF !__dbOpenSDF("testlong.txt", aStruct)
User avatar
serge_girard
Posts: 3412
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: __dbOpenSDF keeps giving me errors.

Post by serge_girard »

Would something like this be helpful ?

Code: Select all

aStruct := {}
AADD(aStruct, { 'ID1', "C", 10, 0 })
AADD(aStruct, { 'ID2', "C", 10, 0 })
DBCREATE("testlong.DBF", aStruct)
USE  testlong
APPEND FROM "testlong.txt" SDF
There's nothing you can do that can't be done...
HGAutomator
Posts: 200
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

Re: __dbOpenSDF keeps giving me errors.

Post by HGAutomator »

No, but thanks Serge. I've worked with that strategy in previous years, and used data dictionaries to deal with longer field names. But some of our newer delimited files are huge and surpass DBF limits.

We won't be using the RDDs for this.


T & R,

DC

serge_girard wrote: Sun Jul 19, 2026 5:27 pm Would something like this be helpful ?

Code: Select all

aStruct := {}
AADD(aStruct, { 'ID1', "C", 10, 0 })
AADD(aStruct, { 'ID2', "C", 10, 0 })
DBCREATE("testlong.DBF", aStruct)
USE  testlong
APPEND FROM "testlong.txt" SDF
Post Reply