No announcement yet.

"dBase Library for PB-DOS" Contribution

  • Filter
  • Time
  • Show
Clear All
new posts

  • "dBase Library for PB-DOS" Contribution

    And again, PowerBasic for DOS is not death.
    For many cases, the old dBase DBF file format is still the best choice to use.
    The old rule "fixed length records waste a lot of valuable space" also won't really matter in todays time, where a "normal" OS already grabbs a few GB of your harddisc.

    Flat files, speedy access, transparent and calculatable records, still a great solution for all kind of medium sized datastructures.

    How easy to handle any kind of dataset with a predefined number of records ...
    How easy to handle a whole year on a daily base. Just use a DBF file with 365 records ...

    The library is available for PB-Dos and PB-Win/CC, using exact the same commands.

    To handle further updates and changes better, I decide to host the whole archive on my own webspace. Please go to below link to download the actual archive as well as additional informations (if available) ...

    The dBase file format is well designed, but not completely documented for public. A lot of analysis and debugging was necessary to build up this library. All my thanks goes to

    Daniel P. Stasinski
    Richard Maurino
    Erik Olson
    and Manuel Valdes
    This library is based on ideas, code and inspirations from them.

    If anybody has some ideas for functions or other enhancements, feel free and drop me a PM ...
    Hopefully, this all is still useful for somebody out, at least for me it is ...

    Have fun

    Last edited by Gerhard Kropf; 21 Jul 2015, 08:15 AM. Reason: typo :-)

  • #2
    First, this is agreement, dBase files can still be useful (and not just PBDOS).

    More than flat and fixed record count databases, also relational and multiple indexes.

    It is well documented if you use the AKA "XBase". For example see, and included link

    ((minor question - how did you arrive at 364 records in annual database? typo?))

    Easier to manually repair an XBase file than an mdb.



    • #3
      >For many cases, the old... is still the best.
      Yes...I'm a fan.
      Thanks Gerry...Great stuff!


      • #4
        >The library is available for ....PB-Win/CC, using exact the same commands.

        Also available on Win/32:

        dbase ODBC drivers:

        dbase (IV) OLE provider

        These options are NOT available under MS-DOS.



        • #5
          The right tool for a given job ...

          There might be situations, where you really need ODBC, JET, SQL, Btrieve, c-treeACE, FLAIM, NuoDB, BDB, ... or one of the variouse others around.

          And in times, where a simple "hello world cooking recipe administration tool" with 45MB filesize can be sold, many people consider the above as a cool solution to handle a few 100 recipes.

          But to be fair, we should also accept, that such solutions are "sometimes" a bit oversized and overkilled.

          Please, keep this thread clean, it is no flame war pro or against something. It is just a contribution for all outside, who will have a benefit from. And I guess, the people who do have a benefit from know this very well.



          • #6
            But to be fair, we should also accept, that such solutions are "sometimes" a bit oversized and overkilled.
            Let's also be fair to those who design commercial package solutions for business.

            What might be 'oversize' or 'overkill' for 'User A' could be just barely sufficient for 'User B.' As a designer you pretty much have to deal with the "worst case scenario."

            I have said for many years both here and elsewhere that what makes a particular software solution "right" is totally and completely up to the user. I have no reason to change my story now.



            • #7
              again, "The right tool for a given job ..."
              btw. thats why we all use PowerBasic, "because all the .NET spoiled mass-users out cry for" ...

              Last edited by Gerhard Kropf; 30 Jul 2015, 09:43 PM.


              • #8
                I Spent all day figuring out the TYPES for DBF files and i just found out there is a recend thread for it... hehehe.

                I plan to use this in an android app, i made some UDT's based on these:

                Why are some parts of the UDT blank? there are some fields mixed with the unused fields that I think are used. Are these unimplemented features of the example or they never were used in real world?


                • #9
                  Do you mean the "reserved" members, or the member for the number of digits after the decimal point when a character field is being defined?

                  Been at least a decade since I worker on the guts of a dBase/XBase file. One thing that come immediately to mind is ththat the header and field definitions are padded to a multiple of the record length, then the first record starts.


                  • #10
                    I meant the fields that are betweeen the unused fields. I am not sure that those are for though. That's why i ask.


                    • #11
                      try this reference instead.

                      The field descriptor items between unused are labeled, so I don't understnd the problem.

                      Maybe confusing data records, which aren't really UDTs with field decriptors which can conveniently kept in UDTs?


                      • #12
                        Thanks Dale, it worked.


                        • #13
                          I ported the whole dBase library to FreeBasic ...
                          All versions are supported ... even FBC for ARM on a Raspberry PI


                          • #14
                            I used to read the old stuff direct from the file. Main meat of the code was pretty simple:

                            Type DB3Header
                                ver        As Byte ' 03H without .DBT, 83H with .DBT 
                                year       As Byte
                                month      As Byte
                                day        As Byte
                                numRecords As Dword
                                headerSize As Word
                                recordSize As Word
                                reserved   As Asciiz * 20
                            End Type
                            Type DB3FieldDesc
                                fieldName    As Asciiz * 11
                                fieldType    As String * 1 'CNLDM
                                dataAddress  As Dword
                                fieldLength  As Byte
                                decimalCount As Byte
                                reserved     As Asciiz * 14
                            End Type
                            ' C= Character
                            ' N= Numeric- -.1234567890
                            ' L= Logical- ?YyNnTtFf
                            ' D= Date YYYYMMDD
                            ' M= Memo with 10 digits representing a .DBT Block#
                            Mobile Solutions
                            Sys Analyst and Development


                            • #15
                              One shortcoming of the dBase format files is that it doesn't support Unicode text fields. So, I've modified my applications to handle non standard "U" (UTF-16) field types, additional to the standard "C" ANSI text fields. I think PBDOS doesn't, but PBCC6 / PBWIN10 have all the necessary tools to do it quite easily.