





                               TITANIC

                 Save our .DBF files, time and money

                     Version 98.04 (april 1998)







      ---------------------------------------------------------
      ---------------------------
      ------------------------------------
      -------------------------------------
      -------------------------------------
      ------------------------------------
      -------------------------------------
      ---------------------------------
      ---------------------------------------------------------




                             User manual











                For friends of SHAREWARE prepared by


                        Ing. Branislav Stofko

                           Trebisovska 21

                     821 01 B R A T I S L A V A




              Copyright 1997-98 by B. Stofko Bratislava
                         All Rights reserved


 1.  Some words from history
-----------------------------

In the times when TV was only black and white, I saw a movie about the
catastrophe of the ship TITANIC. My  father told me that the number of
persons saved could have been higher if there had been better coopera-
tion  from other  ships. Well,  on  this  ship were  some people  from
Slovakia and therefore the name of the TITANIC is known here.

Today  many  people  use  PCs  and  most  of  them  don't  think about
a possible catastrophe in the case of the computer. Some problems with
power,  your  network  or  perhaps  a  storm  can cause destruction of
a .DBF file used by Dbase, Clipper, FoxPro and FORCE.

The number  of people connected in  some way with computers  is incre-
asing. Most of them have unlimited  confidence in the PC. But the real
life situation is more complicated as you can see on TV.

Every time I begin  to write a new program the first  thing I think of
is  the name  of the  program.  My  friend says  the TITANIC  isn't an
"optimistic" name for a program. My program TITANIC can't save 100% of
your data in all cases, but  it can significantly reduce the amount of
lost data. Anyway  the save operation is easy  and quick in comparison
to manual editing of a .DBF file with a binary editor.

 2.  Structure of DBF file
---------------------------

The advantage of .DBF files is the fact that they are transported with
your definition at the beginning of  the file in the file header. This
is analogous  to a snail, which  carries his home on  his back. If you
are sending  a .DBF file it  is not necessary to  add a description of
the file.

There is a  disadvantage with a header. The header  is the part of the
 .DBF file,  and is the  most updated  part  of it. In  the header are
stored date, time and record counter after every update. If the struc-
ture of  the DBF header is  destroyed, you are not  able to access the
 .DBF file.

    A DBF file consist of three logical parts:

   ===================================================================
   |                    | If this part is damaged                    |
   ===================================================================
   | Parameters of file | file can't be opened, wrong record count   |
   ===================================================================
   | Field description  | field can't be opened, bad or shifted data |
   ===================================================================
   | Data               | bad or shifted data                        |
   ===================================================================

 
                                                   TITANIC  3 of 7

 2.1 Parameters of file
------------------------

 Offset Size      Description

   00   byte      dBase version 03h=dBASE III without .DBT file
                                83h=dBASE III with DBT file
   01   byte      year
   02   byte      month
   03   byte      day
   04   dword     long integer record count
   08   word      header size
   10   word      record size
   12 20bytes     reserved

Files used by FoxPro have another value in the first byte. The TITANIC
program completely restores all these parameters so you need not worry
about it.

 2.2 Field descriptions
------------------------

 Offset Size      Description

   00  11bytes    field name
   11    byte     field type Char/Num/Logical/Date/Memo
   12    dword    long integer field data address, (set in memory)
   16    byte     field size
   17    byte     decimal count inclusive decimal point
   18  14bytes    reserved

The count of descriptions is equal to the field count of the file. The
TITANIC program  completely restores all these  parameters so you need
not worry about it.

 2.3 Data
----------

Every record is preceded by one byte used as a deletion marker. If you
have,  for example,  a file  with ZIP  and City,  physically the valid
record is " 82101Bratislava "  and deleted record "*82101Bratislava ".
The  actual  reduction  of  .DBF  file  size  is  achieved by the PACK
command. You can use my DBF editor BROWSER for this action.

In the record fields are stored without any delimiters. All values are
stored as ASCII characters including the decimal point.

The date field format is different. For example the date 12.05.1997 in
European format is stored as 19970512. The separators aren't stored!

In a  MEMO field is stored  the number of the  corresponding record in
the .DBT file. If this field  is empty a corresponding DBT record does
not exist.

The  TITANIC  program  can't  always  automatically  restore all data,
therefore in some cases it will need your assistance.

 
                                                   TITANIC  4 of 7

 3.  How to work with the program
----------------------------------

The TITANIC program can be stored on diskette, in a directory accessed
by PATH or in a separate  directory used only for TITANIC. The current
directory is  important. You can  select the current  disk and current
directory within the program.

TITANIC creates  an output file  with the name  TITANIC.DBF . If  this
file already exists it will be overwritten without warning! I hope you
aren't using .DBF files with this name.

The  program must  have a  sample .DBF  file from  which to obtain the
correct header. The sample file should  have the same structure as the
damaged file or at least the same  record size. The sample file can be
empty.  Many programs  use a  "monthly" file  for example JAN1999.DBF,
FEB1999.DBF ...

TITANIC uses a sample file in read-only mode therefore the sample file
can't be modified or damaged by TITANIC.

Some programs are able to create a  .DBF file simply by starting in an
empty directory. Try to use this method if you haven't a usable sample
file. If you are not able to obtain a sample .DBF file you must create
one.  There are  many utilities  for this  purpose. I  use my  own DBF
editor BROWSER.

If your .DBF  files don't use the extension .DBF,  you must rename the
sample and damaged files to have the .DBF extension.

                            W A R N I N G

If  you try  to use  damaged .DBF  file as  sample, this  is not  only
logically wrong, but my program TITANIC will hang as would every Xbase
program!

 3.1 First case
----------------

If only the  file parameters are damaged it is  enough to specify only
the sample and damaged files. All  will be done without your assistan-
ce. Saved  data are stored in  the file TITANIC.DBF .  The sample file
and the damaged file cannot be the same file.

                            W A R N I N G

Newer delete the damaged file before you are sure about the content of
the file  TITANIC.DBF. The TITANIC.DBF  file should be  renamed to its
original name,  but first store  the original damaged  file in a  safe
place. You can then repeat the action if it should be necessary.

 3.2 Second case
-----------------

If  there  are  damaged  field  descriptions,  TITANIC  will  seek the
BEGINNING OF  DATA marker. If  this marker is  found, the program  can
restore the header from the sample and the date from the damaged file.
Your assistance isn't needed and the program proceeds.
 
                                                   TITANIC  5 of 7

 3.3 Last and the worst case
-----------------------------

If the BEGINNING  OF DATA marker cannot be found  it isn't clear where
data begins.  TITANIC will try to  compare data from the  damaged file
with a  mask derived from  the database structure.  This is of  course
slow. On the screen you will see scrolling data.

TITANIC stops in the place where data conform to the mask. You can say
OK or  shift begin to left  (back) or to right  (forwards). For bigger
movements the Page Up or Page Down keys are available.

IF the damaged file is  totally overwritten with garbage data, TITANIC
can't find any place to start. If  you want to save the content of the
damaged file, you must prepare a compatible sample file, where all the
fields are of  character type. With this method  you can dispense with
the TITANIC's tests for numeric data.

The program uses  a mask only 50 bytes long.  Therefore only the first
50 bytes are compared with the mask if the record size is greater than
50. In  a well-designed file the  most important fields are  placed at
beginning  of record.  If in  the position  of numeric  data there are
other than numeric ASCII characters, this  is treated as an error. The
weakest test  is on character fields.  Of course if the  actual record
size is less than 50 bytes only this size is compared.

You can see the mask and data. Well now we will have an example:

     Example file

     CODE        Character   6
     NAME        Character  12
     PRICE       Numeric    10 3
     VAT         Numeric     2

For this file TITANIC creates following mask:

     CCCCCCccccccccccccNNNNNNN.NNnn

and the correct data are:

     CCCCCCccccccccccccNNNNNNN.NNnn
     ZCU400Connector        52.5010

If you select the right place  to start recovery by pressing the ENTER
key, recovery  begins automatically until  the next problem.  If later
a difference is found between mask and saved record, you can:

a. Copy the bad record
b. Skip the bad record
c. Find a better place to start current record

Anyway your data in the output file  may not be correct. If the record
size is  greater than 50  bytes an error  in the non-checked  part can
occur. You  must inspect the  file in places  (records) where problems
are reported.

Maybe some saved record must be repaired or deleted?


 4.  Enclosed files
--------------------

    You can start with the TITANIC program on the enclosed files:

1.  SAMPLE.DBF is an empty sample file

2.  DAMAGED.DBF is a damaged file in region of file parameters and
    partially  in field  descriptors too.  Try to  open this file with
    standard programs, and you will see that this file isn't usable.

3.  FATAL.DBF is file with damaged BEGINNING OF DATA marked.
    You must start the recovery with the mask.

4.  TOTAL.DBF is a really totally damaged file. This file is a renamed
    .OBJ file.  It isn't possible to  recover one record. But  you can
    try TITANIC to have an experience for future use of program.

 5.  Working with the program on a network
-------------------------------------------

TITANIC isn't  developed for network use.  The output file TITANIC.DBF
is stored in a single-user environment.

Sample file and damaged file can  be stored on network drive. Both are
used in read-only mode.

 6.  How the program works in WINDOWS
--------------------------------------

The  program was  tested in  WINDOWS 95.  It can  be used  in DOS, but
I have no one working in a pure DOS environment for tests.

In  the  distribution  package  is  an  icon  TITANIC.ICO  .  Icon and
TITANIC.EXE should be stored in the same directory.

 7.  Why is this program SHAREWARE
-----------------------------------

Many of my programs are FREEWARE. And in some cases these programs are
able to help significantly to save you money by shortening development
time. One of these is LGE or CLF.

The TITANIC program  can help you in case of  a damaged .DBF file. You
can save  time and money  at home  and  your workplace. I  want you to
register  this program.  TITANIC is  declared as  SHAREWARE or  better
CARDWARE.  If you  like the  program and  continue to  use it, you can
register for FREE by sending me  a colorful postcard with your address
and where  you found your copy  of TITANIC. I would  also like to know
what type of computer and operating systems you are using.

I am waiting for postcard from your city or country.

Branislav Stofko
Trebisovska 21
821 01 Bratislava
Slovak Republic

 
                                                   TITANIC  6 of 7

And if  you really like this  program, why not contact  the editors of
your favorite computer magazine or newspaper, or web sites that review
software and tell them  about it ! That's a great way  to make my work
better known.

If you have any questions, please email me at

  <branostofko@rocketmail.com> or <stofi@geocities.com>

Questions from registered users are answered first. An E-mail isn't
a valid way to register.

If you are able translate this  text to your own language, please send
my a copy by Email.

The  author  of  this  program  accepts  no  responsibility for damage
resulting from its use and makes no warranty or representation, either
express or implied, including but not limited to, any implied warranty
of merchantability  or fitness for a  particular purpose. This program
is provided  "AS IS", and you,  its user, assume all  risks when using
it.


 
                                                   TITANIC  7 of 7


                        C O N T E N T









 1.  Some words from history                                         3

 2.  Structure of DBF file                                           3

 2.1 Parameters of file                                              4

 2.2 Field descriptions                                              4

 2.3 Data                                                            4

 3.  How to work with the program                                    5

 3.1 First case                                                      5

 3.2 Second case                                                     5

 3.3 Last and the worst case                                         6

 4.  Enclosed files                                                  7

 5.  Working with the program on a network                           7

 6.  How the program works in WINDOWS                                7

 7.  Why is this program SHAREWARE                                   7
 
                                                   TITANIC  2 of 7