HP2REX v0.91 beta   16 July 2000
HP200LX to REX-3 PIM Data Convertor

This program is copyrighted freeware.  I release the code for free
personal use.  You may not sell the program, or otherwise make money
from it, without making arrangements with the author.  I do not claim
that this program works, nor will I claim that it won't wipe out your
HP200LX and REX memory.  So BACKUP everything before you try this code.

========================================================================
Acknowledgements:
========================================================================

I want to thank several folks who have been of great assistance in this
work:  

  Mack Baggette, for writing the code to read/write from/to a REX card.
    He has been of invaluable benefit to the palmtop community, and I
    thank him for taking time out of his busy schedule for my little
    REX project.

  Holger Lembke, Philipp Adelt and "Rex Tech".  These guys did the brunt
    of the work early on, when the REX was first out, in figuring out the
    data storage format.  Holger maintains an excellent website that shows
    the results of all this research, and all sorts of neat information
    and links about the REX (http://www.hlembke.de/rex/index.html)

  Petr Hlineny of the Univ of Toronto - Petr contacted me a few weeks ago
    and shared with me the results of his independent research into the
    REX.  This information both helped me solve the mystery of a few
    remaining bytes. His correspondence also re-invigorated my interest 
    in the HP2REX project, which had been dormant during a recent busy
    spurt in my work and family life.

  The small group of assistants who volunteered to send me their REX
    data file dumps. This helped me to understand the format of the data.  
    Without your help, I would have never figured it all out. (And I'm
    still making good use of these files working on the other REX sections
    like the CLDR data).


========================================================================
Files
========================================================================

Files Provided in ZIP Distribution Archive:

  readme        This text file
  hp2rex.exe    Data Convertor Program
  rexwr.exe     REX-3 Transfer Program (courtesy Mack Baggette)
  h2r.bat       Sample Batch File
  file.map      Example contacts .MAP file
  file.mdf      Example MEMO definition file


Other File Needed:

  gdbio.exe     Extracts Phonebook Data into .CDF File


Input Files Used by the Program:

  CONTACTS:
    file.PDB      used only by gdbio
  
    file.CDF      generated by gdbio, read by hp2rex
    file.MAP      generated onetime by gdbio, hand modified for REX-3 use
                  (see instructions below)
  
  MEMOS:
    file.MDF      list of text files to be used as REX-3 MEMOs
  
Output File:

    file.BIN      REX-3 Binary Image File


========================================================================
Program Usage:
========================================================================

If you want CONTACTS data transferred, generate .cdf file from your phone 
book file using the following gdbio command: 

  gdbio c:\_dat\file.pdb /n >file.cdf

If you want to transfer some MEMO files, prepare a file.MDF using a standard
text editor.  It should only contain one filename per line.  See the example
file.mdf provided.

(If you want CONTACTS data transferred, you must also have created 
a file.MAP; this is a one-time step and is described ib the next section).

Now generate the REX binary file:

  hp2rex file -[cm]

  where:
  
    file       is the base filename
  -options (one or both must be present):
     c         process and generate CONT section
     m         process and generate MEMO section

Next save the .bin file to your REX card:

  rexwr file.bin   


See the batch file H2R.BAT for en example of running the program
automatically and updating your REX with one command.  You will need
to edit this file to properly reflect your actual filename(s).


========================================================================
CONTACTS Setup:
========================================================================

Generate a file.MAP using the gdbio command as follows:

  gdbio file.pdb/s >file.map

Then using your favorite text editor, edit the file.MAP file to include
an extra column os data.  This extra column indicates which REX data
field each HP daya field will be mapped into, and is placed between the 
first FLD column and the second NAME column.  A list of the REX field 
names and corresponding numbers follows:

REX    
FLD   REX FIELD
NUM   DESCRIPTION
===   =================
  0   LAST NAME
  1   FIRST NAME
  2   COMPANY
  3   Title
  4   Work Address
  5   Work-Addr2
  6   Work-City
  7   Work-State
  8   Work-Zip
  9   Work-Country
 10   Home-Address
 11   Home-Addr2
 12   Home-City
 13   Home-State
 14   Home-Zip
 15   Home-Country
 16   WORK PHONE
 17   HOME PHONE
 18   EMAIL
 19   WORK FAX
 20   HOME FAX
 21   CELL PHONE
 22   CAR PHONE
 23   PAGER
 24   OTHER
 25   MAIN PHONE
 26   WEB
 
For example, consider the .map file that I prepared for my installation.  
You will see the extra column of integers that I inserted with the heading 
of "Rex".  This example will probably work with minimal modofications
for others installations as well.  Note that I have a slightly modified
.PDB file - I have added an e-mail field to it.  If you have a standard
.PDB file, you will have to modify this example slightly.

<BEG EXAMPLE FILE.MAP>
Fld Rex Name                 Type      Off Reserved     Flags
  1  0  Na&me                string      0              Relative
  2 16  &Business            phone       2              Relative
  3 17  H&ome                phone       4              Relative
  4 24  &Alternate           phone       6              Relative
  5 19  Fa&x                 phone       8              Relative
  6  3  T&itle               string     10              Relative
  7  1  Cate&gory            category   12 CatRec=0     Relative
  8  2  Com&pany             string     14              Relative
  9 18  &e-mail              string     16              Relative
 10  4  Address&1            string     18              Relative
 11  5  Address&2            string     20              Relative
 12  6  &City                string     22              Relative
 13  7  Sta&te               string     24              Relative
 14  8  &Zip                 string     26              Relative
 15 27  &Note                note       28             
<Section w/Category Names Omitted for convenience>
<END EXAMPLE FILE.MAP>

The REX database has separate fields for FIRST and LAST names.  The
HP200 phonebook app does not - it has only a NAME field.  Therefore,
I chose to store the HP's CATEGORY field as the REX's FIRSTNAME.  This
way one can sort the REX data on category, which may be occassionally
useful.  Note that this current version of the program only stores
one subset, or cardfile, into the REX.  This is what is commonly called
the ALL cardfile.

========================================================================
MEMO Setup:
========================================================================

If you want to store MEMOs into your REX, use the -m option.  The
program will look for a file.MDF (Memo Description File) and will
scan it for filenames - one per line.  It will then open each file,
and store it into the REX MEMO format.  The first line of each text
file is interpreted by the program to be the title.


========================================================================
FEATURES TO BE ADDED:
========================================================================

- Read HP200 APPT database and store this into REX's CLDR and TODO
  sections.

- Read NoteTaker file(s) in addition to plain text files for the
  MEMO section.

- Add capability to read HP databases directly, thus eliminating the
  need for separate extraction programs. (low priority)

- Write to REX card directly from hp2rex program, eliminating the
  separate step of REXWR.  This would also eliminate to need for a
  256KB intermediate file.


========================================================================
Revision History
========================================================================

0.90  Initial Beta Release

0.91  Fixed number of HP Phonebook fields, was haardcoded to 15.  Now
      is a variable obtained from your .map file.  Also changed args to
      fopen() of REX output file to update mode.

========================================================================
Contact Information
========================================================================

Please feel free to contact me as indicated below with any feedback,
suggestions, and/or bug reports.

             Chris Lott

  E-MAIL:    rclott@ro.com

  ADDRESS:   R. Christopher Lott, P.E.
             %Alpha Beta Technologies, Inc.
             3112 12th Ave, S.W.
             Huntsville, AL  35805


