;
                                    ZDB.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
               7k (56)   AC6C  1.0        Joe Mortenson 11/90      Z3COM31

  1- Overview  2- Installation  3- Usage  4- File Structure  5- Patching      


   ZDB (Z-Database) is a small (7K),  simple,  but very fast, name and address
file with label and envelope  printing output,  sorting by last and first name
or by zipcode,  and  fast  search.   Z-System  dependent,  it uses some of the
graphics capabilities of VLIB4.   Can make use of a clock for automatic dating
of entries.   WordStar-style  editing  keys for data entry and updating.   New
output options for labels.   Written in Z80 assembler and  developed with ZMAC
and ZML,  using the V4LIBS.   Should be compatible  with almost any Z80 system
running Z-System.
:1
 Overview 

   ZDB is a simple name and address  file  capable of  printing mailing labels
and envelopes.  There is not much unique about that.   What sets ZDB apart are
its size (under 7K) and  speed  (written in Z80 assembler),  its use of the Z-
System extended TCAP and VLIB routines for screen  graphics and  cursor  move-
ment,  its easy editing mode,  and its use of the internal clock to date each
entry automatically.  ZDB will also search for any string (or part thereof) in
any field (using an adapted SCANNER from SYSLIB).   An express search for last
name uses an in-RAM index of  pointers  for  blazing speed.   The sort routine
will sort the records  alphabetically  by  last  and first names or by zipcode
(new with 1.0) and write a new file.   The old file is renamed and retained as
a backup.   The new file is  automatically reopened after the sort is done and
the first record displayed just as on startup.   Label  printing options allow
the selection of any one of four keys for the output.

   ZDB is fully  Z-System  dependent.   If you lack  a clock,  ZDB  allows for
manual entry of the date.   ZDB does not require an RCP or FCP or IOP to work.
It does need the extended TCAP with the 13 graphics characters.
 Overview - 2/2 

   ZDB was  edited with  ZDE,  assembled with ZMAC,  and linked with ZML using
DSLIB, VLIB,  Z3LIB, and SYSLIB routines.   It was developed on a Kaypro II'83
-- 5 MHz with 20 Meg Seagate,  TurboROM, Rembrandt (from Spectre Technologies)
character ROM for primitive graphics, Kenmore clock, and Z-System.
:2
 Installation 

   If you're running ZCPR3.3+,  ZDB needs no ZCPR3 installation, but if you're 
running ZCPR3.0, you need to install ZDB in your usual way.

   Before using ZDB you will need to  patch it  with  your own return address.
You may also need to change the standout video flags or printer codes to match
your terminal or printer.  See Patching.
:3
 Usage 

   Entering 'ZDB /<cr>' at the command line will  produce a help message.   If
you also enter a data file name,  ZDB will look for it,  create it  if it does
not exist, and display either a blank record (if it's a new file) or the first
non-erased one in the file.   If  no  file  name is  specified,  ZDB  will use
ZDB.DTA as the default data file name.

   If you don't have an internal clock  (or have  a clock module loaded),  ZDB
will ask for the current date.  If you wish to quit at this point, enter ^C at
any time while entering the date.

   The ZDB menu is displayed at the bottom of the screen:

A=Add E=Edit D=Delete F=Find X=Xfind >=Next <=Prev P=Print ^S=Sort Q=Quit
 Add 

   'A' for Add is the command used to  enter  new  records.   The  display  is
cleared and the cursor placed in  the first field ready for your entry.   Each
field is marked off with  angle  brackets -- >           < --  so you know how
much space you have.   If you try to enter more characters than allowed in any
field, you will get beeped at, but you can back up and fix things.  ^X, TAB or
RETURN moves to the next field.   ^E moves to the  previous  one.   ^S/^D move
cursor left/right.   Arrow keys are intercepted and interpreted properly.   ^Y
deletes from character at cursor to  end  of line.   After the last field, you
are given a choice of  redoing the  entry to correct any mistakes or omissions
or saving.  Press ESC at any point to finish the entry.  Boxes near the bottom
of the screen display editing keys and give prompts.   On  completion of a new
entry you are given the option of continuing  to  add new records or quitting.
When you finish entering new records,  you  automatically are given the option
of having the file sorted.
 Edit 

   'E' for Edit works exactly like Add except that it is for updating existing
information.  You cannot edit the date.  It is changed automatically.
 Delete 

   Pressing 'D' lets you eliminate a record from the file.   You are  given  a
chance to say no if you mistakenly  press the 'D'.   The record is filled with
nulls except for the first byte which is  0FFH.   When you do  a sort,  erased
records are dropped from the new file.   Deleting a record does not change the
record count in the upper left corner of the screen  since the  deleted record
is still in the file until a sort is done.   Deleted records are not displayed
or printed.
 Find 

   There are two search routines in ZDB.   "Express Search"  is for last names
only.  Press 'X' at the  main  menu.   A  box  appears  and  asks  your input.
Partial strings, even one letter, are OK.   The routine is not case sensitive.
The first record to match your request is displayed.   You may stop the search
at that point or continue.  If there's no match, you are told.

   The other search works on any field but is slower.  Press 'F' for this one.
You may enter up to ten characters in the search string.   "Find"  is not case
sensitive, so "JOE" and  "Joe" and  "joe"  are  all the same to ZDB.   Partial
strings are fine.   Entering "Jo" to search for "Jones" will get the job done.
You can enter more than one word, e.g., "St. Paul," as long as they are in the
same field.   If the search string is found in  any field of any record,  that
record will be displayed on the screen.  You may then opt to end the search or
continue it.   If there's no  match,  ZDB tells you so.   Even in fairly large
files, Find works quickly.   Express  Search and Find are also available under
the Output routine.
 Next, Previous 

   Next and Previous are for browsing through the file.   Pressing '>', or '.'
both work for Next.  '<',  or ','  both work for Previous.  If you  are  going
backwards through the file  and  reach  the  first  record,  another  Previous
command will go to the end of the file.  "Next" acts in a similar fashion when
it reaches the end of the file.   Two other commands, not on the menu, are 'T'
(Top) and 'B' (Bottom).   They quickly take you to the first or last record in
the file.
 Print 

   Print has a submenu offering a choice of printing labels or envelopes.  The
label option gives the further choice of printing a single label,  those which
match a key, multiple copies, or the entire file.   When you select 'Key', you
will be asked to select city, state, zip code, or a special code.  The special
code looks at the first two letters of the  Comments2  field for a match.   If
you want to make labels for your Christmas card list,  you  could  use 'CL' as
the first two characters in the  Comments2  field as your code.   There's room
for lots of  imagination  for  the  use of  this feature.   Both the label and
envelope option allow you to use Find, Xfind, or Next before issuing the print
command.  Printer escape codes (Epson FX-85 compatible) are near the beginning
of ZDB and may  be  patched  as the user wishes.   A  return  address  for the
envelope is also  hard  coded  in  ZDB and  should  be changed for your use or
eliminated.  See Patching.
 Sort 

   To avoid accidental sorts the command key is now  ^S  (Ctrl-S)  and you can
still abort after that.   Sort first indexes the  file in use, sorts the index
by last name and first name or by zipcode,  depending on your choice, and then
writes a new, sorted file in the  current  directory  with  the  original file
name.   The old file is retained as  a backup with the name BACKUP.DTA.   If a
previous BACKUP.DTA file is present,  it  is  deleted.   Deleted  records  are
purged when Sort writes a new file.   Sort works very  fast  even  on a floppy
system, with most of the time  spent  writing the  new  file.   On a hard disk
system it works in a matter of seconds.   On  a RAM disk it would be something
else.   When a sort is done an index requiring 16 bytes per record is created.
20K of free RAM would allow files of 1280 records to  be  sorted,  well beyond
most people's requirements.   Since ZDB takes less than 8K of RAM,  most users
will have 35-40K or more of free memory.
:4 
 File Structure 

   ZDB's data file uses a 256  byte  record  so  that  each  one  is on a page
boundary.  There is no header to the file.  File size is limited to a mere 64K
256 byte records  --  due to the use of  16  bit  counters  for  the number of
records and the file pointer.  Disk capacity is the real world limiter on file
size.  On a 390K floppy, ZDB itself will take 8K.   Divide the  remaining 382K
by 2 (you need twice the space in order to do a sort) to get maximum file size
-- in this case 764 records of 256 bytes.
:5
 Patching - 1/7 

   ZDB has a  patchable flag  to  control  whether a character will be used to
terminate each field in the display,  and if so,  which  character  should  be
used.   A termination  character is useful if your terminal is set so that the
entire data fields are not shown, for example,  dim standout on a dark screen,
so you can tell where the end of the field is when adding or editing fields.

010Bh
TERMF     db   '<'  If a character ('<' is default), use that 
                    character to terminate each data field 
                    display.  
                    If OFF (00h), don't display a field 
                    termination character.

   When ZDB is invoked,  you may specify the name of the data file you wish to
use.  If no data file name is specified,  ZDB will use the  default  data file
name patched below.   Enter it as  you would type it,  including the '.',  and
leaving all trailing fields as spaces.
 Patching - 2/7 

010Dh         'filename.typ' < max
         db   'ZDB.DTA     '
         db   0         ; termination

   The printer escape codes are at 0119h and following.   Labels for each will
help you locate the patch area.   Each string must  be 0-terminated.   There's
plenty of extra room for complicated printer escape codes.   The following are
Epson FX-85 compatible codes.   You can  eliminate  any of  them by making the
first byte 0.   Use ZP, ZPATCH or ZAP or DU3 or similar disk editors to do the
patch.  Always keep a backup copy before you patch -- just in case.

	db	'RST'
reset:	db	esc,'@'		; printer reset string
	ds	3		; extra space
	db	0		; termination
;
; Set printer for printing return address:
;
 Patching - 3/7 

        db	'RIN'
rin:	db	esc,'x',1	; printer nlq string
	db	0fh		; condensed print
	db	esc,'p',1	; proportional print
	ds	7		; extra space
	db	0		; termination
;
; Set printer for printing main address:
;
	db	'AIN'
ain:	db	esc,'E'		; set emphasized print
	db	esc,'x',1	; set nlq mode
	db	esc,'p',1	; set proportional print
	ds	4		; extra space
	ds	0		; termination
;
; Set left margin for envelope address:
;
 Patching - 4/7 

	db	'ELM'
lemarg:	db	esc,'l',40	; may also use tabs
	ds	9		; extra space
	db	0		; termination
;
; Set left margin for label address.  Set to 0 if no return address is
; desired.
;
	db 	'LLM'
llmarg:	db	0		; printer init string or tabs/spaces
	ds	10		; extra space
	db	0		; termination
;
; Use return address in label (only if labels are large enough):
;
	db	'LRA'
lra:	db	0		; 0 if no return address is desired
;
; Set number of lines per label:
;
 Patching - 5/7 

	db	'LPL'
labln:	db	esc,'C',6	; set lines per label
	ds	5		; extra space
	db	0		; termination

   A default return address (the author's own) follows the printer patch area.
Look for "RTA" in the code to locate it.  It comes immediately after "RTA".

   You can easily  edit  the  return  address  in  ZDB.COM  using  WordStar in
document mode, just  as you  would  edit  any  other document.   Just keep the
editing to the return address text portion!   If  the  return  address text is
displayed clearly, the editing will work just fine,  and WordStar will put the
cr's and lf's in the right places!   Note that this technique  does  NOT  work
using ZDE!
 Patching - 6/7 

;
; Return address patch goes here.  For normal business size 
; envelopes, the number of line feeds must remain 14 and the string 
; must be 0-terminated.  To eliminate the return address change retadr
; to a terminating null (00h) and put 14 line feeds in addrsp.
;
	db	'RTA'
retadr:
line1:	db	'Joseph I. Mortensen'
	db	cr,lf
line2:	db	'4214 Chelsea Ct.'
	db	cr,lf
line3:	db	'Midland, MI 48640'
	db	cr,lf,lf
	ds	18		; room for more characters
	db	0		; termination
 Patching - 7/7 

;
; Space from return address to address.  For normal business envelopes,
; the total number of line feeds in the return address and addrsp should 
; be 14.  If the return address is the normal three lines, addrsp should
; contain 10 line feeds.
;
	db	'ASP'
addrsp:	db	lf,lf,lf,lf,lf
	db	lf,lf,lf,lf,lf
	ds	4		; room for 14 line feeds
	db	0		; termination
	db	'RTA'
