Cal 6.3 Data File Format
------------------------

The Cal database format has changed slightly in v6.3 to allow for multiple
weekdays in a single positional event and new holiday/skip holiday flags.


A Cal 6.3 data file begins with a 16-byte header defined as follows:


  1 long   Cal format identifier, always 'ca63' for Cal 6.3
  1 long   size of message area in bytes, 20000 for Cal 6.3
  1 word   maximum number of messages in index, 511 in Cal 6.3
  1 word   actual number of messages currently in index
  1 long   offset from start of 1st message to 1st unused byte in database


Following this header is an exact copy of the embedded event data as it
existed when the data file was written.  This area contains one entry for
each event in the database.  Each entry will be an even number of bytes,
from 24 to 120 bytes inclusive, in length, and is defined as follows:


   SIZE  OFFSET  USAGE
  ------ ------ -------
  1 word   00   offset to start of next entry
  1 byte   02   date (range 1..31, or 0 if positional or cyclic event)
  1 byte   03   days notice for this event (0..99)
  1 word   04   month bitflags, one bit set for each month scheduled
                  bits 1..12 are used for Jan..Dec, NOT bits 0..11!
                  if this is a cyclic event, bitflag is ZERO!!!
  1 word        for a date event:
           06     1 word   year for 1-time date event (0 for recurring)
                for a positional event:
           06     1 byte   week position (0..4 = week 1-5, 5=last, 6=each)
           07     1 byte   weekday bit flags:
                           bit 6 CLEAR = Sunday
                           bit 5 CLEAR = Monday
                                  ...
                           bit 0 CLEAR = Saturday
                           bits SET = event DOESN'T occur that weekday
                           multiple weekdays are accepted in one event
                for a cyclic event:
           06     1 byte   bit 0 set = this is a holiday
                           bit 1 set = skip this event on holidays
           07     1 byte   reserved
  1 byte   08   importance (0..9, 9 = most important)
  1 byte   09   HotWire alarm slot (0..16)
  1 word   10   HotWire alarm time - 0 if not an alarm
           10     1 byte   hour (0..23)
           11     1 byte   minute (0..59)
  1 word        for a cyclic event:
           12     1 word   cyclic event start year (1..9999)
                for a date or positional event:
           12     1 byte   bit 0 set = this is a holiday
                           bit 1 set = skip this event on holidays
           13     1 byte   reserved
  1 word   14   cyclic event end year (1..9999)
  1 byte   16   cyclic event start month (1..12)
  1 byte   17   cyclic event end month (1..12)
  1 byte   18   cyclic event start date (1..31)
  1 byte   19   cyclic event end date (1..31)
  1 byte   20   cyclic event period (1..255)
  1 byte   21   number of extended msgs (i.e., not counting the first)
                  this will be zero if there is only one message
  ? bytes  22   main msg - 35 bytes max (including terminating null)
  ? bytes   ?   optional 2nd msg- 35 bytes max including terminating null
  ? bytes   ?   optional 3rd msg- 35 bytes max including terminating null
  ? byte    ?   optional extra zero byte to assure next event starts
                    on an even word boundary



  This information is provided for those who wish to transfer Cal data
  to or from another program or platform.  If you have any questions
  regarding Cal data files, please contact me at one of the addresses
  below.

            Bill Aycock
            May 31, 1992

            Compuserve:  76703,4061
            Internet:    76703.4061@compuserve.com
