Pine Address Book Creation using PMDF Pine

Introduction

Pine address books are quite simple. An address book file contains one address book entry per line and each line contains three tab separated fields. The fields are:

  1. The nick name to be used to identify the entry.
  2. The full name, usually given as first, last.
  3. The email address.

The format is the same for personal address books and global address books. In addition to the address book itself Pine maintains an index to the address book. The index is stored in an additional file. If the address book is PINE.ADDRESSBOOK then the address book index will be PINE.ADDRESSBOOK-LU.

If the index file is older than the address book file, then Pine will recreate a temporary one on the fly in the same directory as the address book file if possible, or in the user's sys$scratch directory if not. So make sure you provide a current index file along with the address book file with read access to all intended users.

The simplest way to create an address book is to use Pine to enter the data into a local address book. Pine automatically create the -LU index and the resultant set of address book files can be used as a global address book by just moving them to a shared location and making sure that they are world accessible. Of course, this method does not lend itself to automation. Automating the creation of a global address book is highly desirable when the source of the data for the address book comes from another location, like and X.500 directory for example.

The general process to automate Pine address book creation is as follows:

  1. Create a text file with the entries.
  2. Make sure the record attributes of the new address book text file are: CARRIAGE_CONTROL carriage_return and FORMAT stream_lf.
  3. Invoke Pine as a foreign command with the -create_lu option to create the index.

There are several options that can be used when Pine is invoked as a foreign command. To see what the other options are use the -h option. The format or the command line to create an -LU file in your sys$scratch directory is:

    $ pine -create_lu file.addressbook ab-sort
    

where ab-sort is the sort order of the address book. There are several possibilities here, and unfortunately Pine does not default to anything when you use the line mode command. The possible values are

dont-sort
fullname-with-lists-last
fullname
nickname-with-lists-last
nickname
    

    $ pine -create_lu []file.addressbook fullname
    

use the [ ] in front of the filename to create the -lu file in your current directory.

Example

This example is a complete standalone example of how to create a Pine address book. This example creates three entries. To use this procedure directly you will want to modify the code that follows the "Create entries ..." banner with commands the will make your own data available to this command procedure.

$   save_verify = "''f$verify(0,0)'"
$   if "''command_debug'" then set verify
$   !-------------------------------------------------------!
$   ! Command procedure to create a PINE address book.      !
$   !-------------------------------------------------------!
$
$   Write sys$output ""
$   Write sys$output ">>> Create a PINE address book         v:18-AUG-1995"
$   Write sys$output ""
$
$   if p1 .eqs. "" then inquire p1 "Name of new address book"
$   if p1 .eqs. "" then goto end_it
$
$   !-- Some local symbols that are nice
$   ab_name = p1
$   tmp_name = "ab-" + f$getjpi ("","PID") + ".tmp"
$   fdl_name = "ab-" + f$getjpi ("","PID") + ".fdl"
$
$   pine := $PMDF_Exe:Pine.Exe
$   a_tab[0,7] = 9
$
$   !-- Logic to create address book entries.  This will generally
$   !   be site specific and reference the data source for a list
$   !   of user names and addresses.
$   Write sys$output "    Create entries ..."
$   open/write ab 'tmp_name
$   write ab "mrbill", a_tab, "MacAllister, Bill", a_tab, "bill@xyz.com"
$   write ab "mrfoo",  a_tab, "Bar, Foo",          a_tab, "foo@xyz.com"
$   write ab "mrdoof", a_tab, "Doof, Harry",       a_tab, "doof@xyz.com"
$   close ab
$
$   !-- Make an FDL so that we can insure that the created file has
$   !   file attributes that PINE will swallow.$   Write sys$output "    Making addressbook FDL ..."
$   open/write a_fdl 'fdl_name
$   write a_fdl "IDENT ""PINE-AB Utility"
$   write a_fdl ""
$   write a_fdl "FILE"
$   write a_fdl "    ORGANIZATION            sequential"
$   write a_fdl ""
$   write a_fdl "RECORD"
$   write a_fdl "    CARRIAGE_CONTROL        carriage_return"
$   write a_fdl "    FORMAT                  stream_lf"
$   close a_fdl
$   
$   !-- Convert the file to its final format
$   Write sys$output "    Converting file attributes ..."
$   convert/create/fdl='fdl_name 'tmp_name 'ab_name
$
$   !-- Create the PINE index file
$   Write sys$output "    Making Pine index ..."
$   pine -create_lu 'ab_name fullname
$
$   Write sys$output "    Cleaning up ..."
$   delete/noconfirm/log 'fdl_name';*
$   delete/noconfirm/log 'tmp_name';*
$
$ end_it:
$   exit $status + 0*f$verify(0,0)
    



Search: