PDB2X - Sync your HP phonebook data to various targets

Archived 2013-12-08
This page has been archived and some links may not work correctly anymore. No updates of this page will be done anymore.

Contents of this page:


Do you use the email software Post/LX by D&A Software?
Do you also keep two email address books on your Plamtop? One as the built-in phone book and another in Post/LX as "post.adr"?

If yes, PDB2ADR may be interesting for you.

There are two ways to automatically create a post.adr from your built-in phone book. One way is to use a smart clip inside the phone book. This method is described behind this link.

Another more comfortable way is to use the program pdb2adr, which is described and available here. With PDB2ADR you can even export mobile phone numbers from the built-in phone book to post.adr for use to send SMS messages with your mobile phone out of Post/LX in conjuction with Stefan Peichl´s PDU (read my mobile Internet page to learn more about this).

In addition, PDB2ADR lets you create your Post/LX distribution list files (*.adr) automatically.

PDB2PHN, which is also included in the PDB2X package, lets you transfer your whole HPLX phone book (only names with one phone number for each name) to your cellular phone. You need Robot/LX and a registered version of WWW/LX for that.

Last but not least, PDB2PIM converts the HPLX phone book to a PIM/PE compatible database format. This is useful if you either want to migrate the built-in phone book entirely to PIM/PE, or if you still use the built-in one as your standard (as I do) and use PIM/PE additionally, so PDB2PIM lets you synchronize both with one batch file call.

I have a batch file called pdb2x.bat which uses all three programs to synchronize my HPLX phone book every night (the batch is called by the appointment book) to PIM, cellphone and Post/LX.

Requirements and Download:

In order to use the programs from the PDB2X package, you need of course a phone book file on your palmtop (usually c:\_dat\phone.pdb). PDB2ADR is needed if you want to synchronize your PDB data with the Post/LX address book. And for PDB2PHN (PDB data synchronisation to the mobile phone's address book) you need WWW/LX in order to establish a connection to your mobile phone.

Other requirements:

  • GDBIO which dumps your phone.pdb into a comma seperated value file and thus prepares your phone boook for use with PDB2X


  • The PDB2X package (download see below) which extracts the relevant data and puts them to stdout (redirect it into the output file!)


  • BIGSORT v2.2 by Turgut Kalfaoglu, if you prefer sorted output


  • SED, the strem editor, for MS-DOS is also needed to sort the full phone book with notes in CDF format. You don´t need it if you don´t want sorted output.

The PDB2xxx.EXE binaries, SED and BIGSORT are considered to be installed somewhere in your PATH in the following description. If they are in a directory not accessable through your PATH, please give explicit paths in the batch file(s).

Name Date File size Hits    
HP Palmtop tools archive Version:1 2013-12-08 3.98 MB 2647


PDB2ADR: Standard setup:

Go to DOS on your LX, create a directory c:\_tmp\ (md c:\_tmp) and do a

gdbio c:\_dat\phone.pdb > c:\_tmp\phone.cdf.

This creates a first comma seperated value file from your phone book which you need to figure out the correct parameters for PDB2ADR.
Open the phone.cdf file in your favorite text editor (preferrably without line wrapping) and search for an entry that has an email address and, if you want to export them too, a mobile phone number.
Such an entry should look like (for example)

"Hertrich, Daniel","","private","","+491231234567","+491212345678","","This email address is being protected from spambots. You need JavaScript enabled to view it.","addressline1","addressline2","",""
Now you have to count in which column which relevant entry is. You need: Name, email address and perhaps the mobile phone number, depending on if you want to send SMSs with Post/LX or not.
Let´s count in my example:
The name is in column 1 (this is most likely also the case in your cdf file).
The email address is in column 8 (you also have to count empty columns (""))
The mobile phone number is in column 5 (+491231234567).

These column associations are the same for every entry.

Now call PDB2ADR this way:

pdb2adr phone.cdf 1 8 5 0 0 > test.adr

and see if test.adr contains the email addresses and phone numbers in the correct format.

(Alternatively, you can call GDBIO once with the /S parameter, which shows the structure of your database. I.e. the output of GDBIO C:\_DAT\PHONE.PDB /S should show you the field numbers you need, so you don´t need to count. ;-) )

Explanation of the PDB2ADR parameters:
1. input file name, must be comma seperated values file, created with GDBIO from the phone book
2. field number of names
3. field number of email addresses
4. field number of mobile phone numbers
5. field number of category names (see description below)
6. category name if 5th parameter not equal 0, otherwise "0". (see description below)
post.adr means rediretion of the output to the file post.adr. If you leave away the redirection, output is shown on the screen, which is only useful for debugging purposes.

If you don´t want phone numbers to be exported, give a 0 as field number for phone numbers, i.e. pdb2adr phone.cdf 1 8 0 0 0 > test.adr.
You can also give a 0 for the email field, then you won´t get email addresses in your resulting file.

The email addresses are exported in the format
Hertrich, Daniel <This email address is being protected from spambots. You need JavaScript enabled to view it.>
and the phone numbers are exported in the format
+491231234567 | Hertrich, Daniel

Please note that email addresses and phone numbers themselves are exported exactly as you enetered them into the phone book, i.e. you have to enter all phone numbers in a format that PDU can directly use. Up to version 2.0, PDU doesn't tolerate any other characters than numbers (even space is not allowed). I asked Stefan Peichl if he could make PDU more tolerant and he did it! Thanks! The new PDU versions (since 2.1, download here) now accepts spaces ( ), dot (.), minus (-), slash (/) and parentheses (()) within a mobile phone number. And of course still the plus at the beginning. So you don´t have to modify all your phone book entries which contained non-number characters for better readability.

So a number like +49.177.1234567 or (0177) 123 45 67 or +49/177-123.45.67 is now accepted.
But be aware that something like +49 (0)177 1234567 will not work, if the 0 between the parentheses is optional, depending on the country code (+49) to be dialed or not. I don´t know if it is also the case in other countries, but here in Germany you have to dial a 0 before a long-distance call but if you dial in from outside Germany using the country code, you must not dial the 0. In the given example, PDU would dial the country code and the zero.

Every email address field in your phone book has to hold just one email address in the usual format name@domain. Nothing else. Otherwise Post/LX will not be able to make use of the entry in post.adr.

Entries with empty email address fields will not be converted into the email address section of the output of PDB2ADR, and entries without mobile phone number will not be taken into the phone number section.

If your test.adr looks good, you can make a backup copy of your original post.adr and let PDB2ADR instead create your post.adr. You even can write a batch file which does that automatically, maybe every night, invoked by the appointment book at 2am, like I do. See a sample batch file for all PDB2xxx programs below!

If you prefer sorted output (the phone.cdf file is not alphabetically sorted!), you have to use a sorting program and run it over the cdf file. I found a program called BIGSORT, written by Turgut Kalfaoglu from Turkey. It is very fast and easy to use. Link see in section "Requirements". Call BIGSORT with the parameter /i, so that it is case insensitive, and redirect its output to a another cdf file, for example phone_s.cdf. Then let PDB2ADR process that sorted file.

If you use commas in your PDB as a delimiter between last and first name ("Hertrich, Daniel" for example), you may have problems with Post/LX as it sees a comma in the To: field as a delimiter between different destinations. To avoid these problems, you should remove all commas from your post.adr file after it has been created. I use sed for this purpose, the command "sed -e s/,//g infile > outfile" creates outfile as a totally comma-less copy of infile.

PDB2ADR Distribution list setup:

Say, you often send emails to all of your family members, maybe to invite them to family meetings or to let them know all the news about your a few months old daughter.

The most convenitent way to do this is to create a distribution list file for Post/LX, say, "family.adr", containing the email addresses of all your family members. PDB2ADR can create that file for you. Just assign all entries which shall be used to create "family.adr" in the built-in phone book to a (new) category named "family" for example.

Then GDBIO the phone book as described above, sort it as described above, create your post.adr as described above and, to create the family.adr, call PDB2ADR in addition that way:

PDB2ADR PHONES.CDF 1 8 0 3 family > family.adr

This will make use of the "category check" feature and create family.adr containing only the plain names and email addresses of those phone book entries which you added the category "family" to. The 5th parameter, which is 3 in my example, is the number of the column in the CDF file which holds the category names. Open PHONES.CDF with a text editor and count which column contains the category to find out which value you have to use here or use the GDBIO c:\_dat\phone.pdb /s command.

When the file has been created, you can compose your message in Post/LX as usual, fill your own email address into the To: header, add a header "BCC" (blind carbon copy) by pressing F2, H and choosing BCC:, and fill it with "file:family.adr".
You could also write that into the To: header, but it is good style not to do this, because if you did that, every receipient of your email could read the email addresses of all other receipients. This is an issue of data privacy protection.

Please note that until version 1.5, PDB2ADR created distribution lists in the \quot;simple\quot; format, i.e. exactly one email address per line. Versions 3.1 and later of Post/LX can handle the more complex distribution list format, which can either contain one email address per line or a name, followed by the email address in the following format per line:
Name <This email address is being protected from spambots. You need JavaScript enabled to view it.>, which is the usual format for the Post.adr file of Post/LX version 3.1 and above (not compatible with earlier Post/LX versions).

The ALLCATEGORIES feature introduced with version 1.3 of PDB2ADR, is removed again for v2.0, because it is redundant now, since the normal post.adr, created with
pdb2adr phone.cdf 1 8 0 0 0 > post.adr (for example) can be used as a distribution list for all phone book entries, at least in versions 3.1 or later of Post/LX.

Also note that when creating distribution lists, the phone number column parameter doesn´t have any effect, as no phone numbers are included in Post/LX distribution lists.

PDB2QLX setup:

PDB2QLX is a new component introduced in version 2.2 of the PDB2X collection. It enables an automatic email address completion feature for email programs, such as Post/LX, Goin' Postal and others.

It does that by extracting the email addresses from the PDB (as PDB2ADR) and writing the raw email addresses to the dictionary file of Quick/LX. Quick/LX is a program written by Andreas Garzotto and downloadable from D&A Software Homepage, which suggests completion of words during typing, based on a collection of words stored in a dictionary file. It can also be used for email addresses, not only for words, and that is what it is ued for here. PDB2QLX reads either all email addresses or only those belonging to a specific category (e.g. QLX) from the PDB and appends them to the Quick/LX dictionary file c:\_dat\quick.dat.

If you then compose an email and write the beginning of an email address in quick.dat, Quick/LX suggest the rest of the address and by pressing the right arrow key, you confirm and Quick/LX will enter the rest of the address. This is very handy to save time with long email addresses and to avoid typos in the address. It is in most cases even faster than to open the email client´s address book and pick the email address.

See the example batch below for an example how PDB2QLX can be used. Detailed instructions are in the PDB2QLX.C file in the PDB2X.ZIP archive. The following screenshot shows Quick/LX suggesting the address This email address is being protected from spambots. You need JavaScript enabled to view it. after typing only som into the address filed of a new Post/LX email message:

In order to keep also the normal dictionary entries of the quick.dat file, it is necessary to do a little processing on each update of the file, not just delete it and let PDB2QLX write it anew, because PDB2QLX cannot keep the non-email entries of the file. See the example batch below. It shows a solution using grep. The line

grep -v ^.*@.*\..* c:\_dat\quick.dat > quick.tmp

looks for email addresses in quick.dat of the format given in the regular expression. It is a simple regexp, which should be sufficient here. It looks for an address of the format *@*.* (* beeing any number of any characters). The option -v lets grep find all lines not matching the regexp. So in quick.tmp there will be the contents of the original quick.dat without the email addresses.

I only let PDB2QLX write some well chosen addresses to the quick.dat file which I need very often. About 10-20 addresses are enough for me. Adding more addresses than necessary blows up the quick.dat file and thus the amount of memory Quick/LX needs constantly. The category check feature of PDB2QLX allows you to select the addresses which should go into quick.dat by simply applying a category (e.g. QLX) to them and letting PDB2QLX only use these categorized addresses. Note that the batch which controls PDB2QLX needs to execute QSYNC after modifying the quick.dat file, otherwise the changes of the file won´t have any effect.

PDB2PHN setup:

For PDB2PHN you can use the same GDBIO-created input CDF file as for PDB2ADR, preferrably the sorted one (phone_s.cdf, see above).

Call PDB2PHN with the followig parameters:

1.: input file name
2.: name field number
3. to max. 7.: column numbers of phone number fields, where the first given field number has the highest priority and the last given number has the lowest priority.
Priority means: PDB2PHN searches the given fields in the order you give them for a phone number. The first number it finds is used. PDB2PHN can only create a file containing records which have one phone number per name and only a phone number, nothing else. So, if you have 4 phone number fields in your database, say, field 4 is the cell phone number, field 5 is the business number, field 7 is the private number and field 9 is an alternative number. If you prefer to have the cell phone number in your cell phone&acute&s phone book, you could use the following command line to call PDB2PHN:

PDB2PHN c:\_tmp\phone_s.cdf 1 4 7 5 8 > c:\_tmp\phonebk.txt

Well, this is only half the work done. You now have a file containing one name per line with one phone number per name in the format Daniel Hertrich|+491771234567.
This file has to be transferred to the cellular phone using WWW/LX and Robot/LX with the Robot script "phone.scr". Please download Robot/LX and phone.scr (comes with the SMS.ZIP package) from www.dasoft.com/filelist.htm and read there about usage. It can transfer whole phone books from and to your cellular phone over cable or over Infrared.

PDB2PIM setup:

PDB2PIM basically copies all contents of your phone.pdb file to a PIM/PE compatible file, i.e. it creates records looking like this:

+p Hertrich, Daniel
   This email address is being protected from spambots. You need JavaScript enabled to view it.
   +49 30 12345678
   +49 177 1234567
   Street address line 1
   Street address line 2
   ZIP code
   | Here are notes which you may have
   | in your PDB file (created

In order to be able to convert even the notes, you have to create a CDF file containing notes. The GDBIO command line which you used for PDB2ADR and PDB2PHN doesn´t do this. So, create a second CDF file from your PDB using:


Now you have a CDF file with notes. This is harder to sort than the other file without notes, but there is a lolution for that. It basically appends every note line to the preceding data line, so every line holds again exactly one record. So it is easy to sort. After sorting it has to be disassembled into the original lines again. All these modifications can be done using SED, the stream editor. See the example batch file below how to call sed before and after sorting! Many thanks to Michel Bel and Tony Hutchins for this smart solution!
If you ever have problems with truncated notes, it may be that one of the programs used here (sed or bigsort or your favorite sort program which you use alternatively to bigsort) cannot handle very long lines. Please see the example batch file at the end of this mage to see how this sorting mechanism works.

Once the sorted CDF file is created, call PDB2PIM with the following parameters:

1. Input file name
2. record delimiter in output file (usually +p, must be 2 characters long and begin with +)
3. to max. 22.: Field numbers to be taken over to the PIM/PE file. No more than 20 fields can be used.
And don´t forget the redirection into the output file again.

That´s all. PDB2PIM creates "+. Contacts.pim" as the first line of the output file, so pim.exe doesn´t complain about the missing time stamp (although it actually isn´t a time stamp ;-) ).

Example batch file for PDB2xxx:

I let my PDB2X.BAT run every night which creates everytime-up-to-date versions of all contact information for every purpose I need them for. I only have to care about my phone.pdb now!

Please don´t use this batch as it is given here, you surely have to adjust paths and file names and field numbers. This batch file is only provided here to give you an idea how I use these tools.

@echo off
:: NEEDS: GDBIO, SED and the PDB2X utilities
:: USES:  SYSLOG utility (not needed, but nice to have)

:: =========== DUMP PDB FILE ============

echo GDBIO without notes...
gdbio c:\_dat\phone.pdb > c:\_tmp\phone.cdf
if errorlevel 1 syslog GDBIO1 ERROR

echo GDBIO with notes...
gdbio c:\_dat\phone.pdb /N /X > c:\_tmp\phonen.cdf
if errorlevel 1 syslog GDBIO2 ERROR

:: =========== SORT DUMPED PDB FILES ============

echo Sorting phone.cdf with BIGSORT...
bigsort /i < c:\_tmp\phone.cdf > c:\_tmp\phone_s.cdf
if errorlevel 1 syslog BIGSORT1 ERROR
del c:\_tmp\phone.cdf

echo Sorting phonen.cdf with SED and BIGSORT...

rem This sorting algorithm is quite sophisticated:
rem 1. sed puts all lines of an entry into one single line,
rem    and puts the marker @~@ between them.
rem 2. bigsort sorts the resulting file line by line
rem 3. sed disassembles the lines again by looking for @~@ and
rem    replacing that pattern with a line break again.

sed -e :a -e "$!N;s/\nN/@~@N/;ta" -e "P;D" c:\_tmp\phonen.cdf > c:\_tmp\phonen.tmp
bigsort.exe /i < c:\_tmp\phonen.tmp > c:\_tmp\phonen_s.tmp
if errorlevel 1 syslog BIGSORT2 ERROR
sed "s/@~@N/\nN/g" c:\_tmp\phonen_s.tmp > c:\_tmp\phonen_s.cdf
del c:\_tmp\phonen.cdf
del c:\_tmp\phonen.tmp
del c:\_tmp\phonen_s.tmp

:: =========== CREATE Post/LX ADDRESS LISTS ============

echo PDB2ADR... Email.ADR (main email address book)
del c:\dfu\wwwlx\adr\email.adr
PDB2ADR c:\_tmp\phone_s.cdf 1 8 0 0 0 > c:\dfu\wwwlx\adr\email.tmp
if errorlevel 1 syslog PDB2ADR1 ERROR (email.adr)
echo. >> c:\dfu\wwwlx\adr\email.tmp
echo ============ END OF AUTOMATICALLY CREATED EMAIL.ADR ============ >> c:\dfu\wwwlx\adr\email.tmp
sed -e "s/,//g" c:\dfu\wwwlx\adr\email.tmp > c:\dfu\wwwlx\adr\email.adr
del c:\dfu\wwwlx\adr\email.tmp


echo PDB2ADR... SMS.ADR (contains phone numbers for SMS delivery)
del c:\dfu\wwwlx\adr\sms.adr
PDB2ADR c:\_tmp\phone_s.cdf 1 0 6 0 0 > c:\dfu\wwwlx\adr\sms.tmp
if errorlevel 1 syslog PDB2ADR1a ERROR (sms.adr)
sed -e "s/,//g" c:\dfu\wwwlx\adr\sms.tmp > c:\dfu\wwwlx\adr\sms.adr
del c:\dfu\wwwlx\adr\sms.tmp


echo PDB2ADR... ABI97.ADR (an Post/LX distribution list based on category check)
del c:\dfu\wwwlx\adr\abi97.adr
PDB2ADR c:\_tmp\phone_s.cdf 1 8 0 3 Abi > c:\dfu\wwwlx\adr\abi97.tmp
if errorlevel 1 syslog PDB2ADR2 ERROR (abi97.adr)
sed -e "s/,//g" c:\dfu\wwwlx\adr\abi97.tmp > c:\dfu\wwwlx\adr\abi97.adr
del c:\dfu\wwwlx\adr\abi97.tmp
copy c:\dfu\wwwlx\adr\abi97.adr a:\_dat\wwwlx


;; =========== CREATE QUICK/LX ADDRESSES ==============

echo PDB2QLX... 

REM Remove email addresses from quick.dat:
grep -v ^.*@.*\..* c:\_dat\quick.dat > quick.tmp
del c:\_dat\quick.dat
move quick.tmp c:\_dat\quick.dat

REM Add email addresses to quick.dat (using category QLX in the PDB):
PDB2QLX c:\_tmp\phone_s.cdf 8 3 QLX >> c:\_dat\quick.dat

:: =========== CREATE CELL PHONE PHONEBOOK FIILE ============

if exist c:\_dat\phonemem.txt del c:\_dat\phonemem.txt
PDB2PHN c:\_tmp\phone_s.cdf 1 6 5 4 7 > c:\_dat\phonemem.txt
if errorlevel 1 syslog PDB2PHN ERROR


:: =========== CREATE PIM CONTACTS FILE ============

echo PDB2PIM...
if exist c:\_dat\pim\data\contacts.pim del c:\_dat\pim\data\contacts.pim
PDB2PIM c:\_tmp\phonen_s.cdf +p 1 2 3 4 5 6 7 9 8 10 11 12 13 14 > c:\_dat\pim\data\contacts.pim
if errorlevel 1 syslog PDB2PIM ERROR

del c:\_tmp\phone_s.cdf
del c:\_tmp\phonen_s.cdf