From: noraa@cbnewsk.cb.att.com (aaron.l.hoffmeyer)
Subject: Re: Is there "mail merge" in Framemaker?
Organization: AT&T Bell Laboratories
Date: Mon, 16 Nov 1992 07:19:50 GMT

In article <1992Nov16.031911.7930@bmerh85.bnr.ca> myhui@bnr.ca (Michael Hui) writes:
[Again]
>Is there "mail merge" in Framemaker?
>Perhaps this is an FAQ? Clearly conditional text won't do the job.
>Has anyone found neat ways to go about this mundane function?
>Like merging a file full of addresses into the beginning of a letter?

There is an application called fmmerge, that is a part of the FUN tape.
Information about the FUN package is included in the FAQ.

The following is the text version of the documentation on fmmerge.


				   ---------
				 / fmmerge /
				 ---------
Introduction
------------
fmmerge is a mail merge utility. It merges a data file with records to
be merged with a FrameMaker document containing user variables to
produce customized copies of the document. These copies can be printed
and/or saved.

This document contains an overview fmmerge works, and how to use
fmmerge.

Overview
--------
fmmerge requires three inputs:

1) template file - this is a standard FrameMaker document containing
embedded user defined variables. These are defined using the Variable
dialog which is accessed through the Special menu. For more details
on how to create and use variables, refer to your FrameMaker
documentation.

In your document, you will imbed user variables which will be replaced
by data from the data file. To avoid confusion, when defining
variables, you should use names that correspond to the data that they
will represent. The following is an example of a template file:

	 -------------------------------------------------------
	| March 18, 1990					|
	|							|
	| $fname $lname						|
	| $company						|
	| $address						|
	| $city, $state $zip					|
	|							|
	| Dear $fname:						|
	|							|
	| Thank you.						|
	|							|
	| Sincerely,						|
	|							|
	| Me							|
	 -------------------------------------------------------
 
In this example those words beginning with a dollar sign ($) are user
defined variables. For clarity, the name of the variable was used as
its initial definition. Your choice of variable names is entirely up
to you, including the dollar sign, used here to help distinguish the
variables from regular text.

2) merge data file - this is an ASCII text file containing records
with fields delimited by a unique ASCII character. Most database
management programs will output this format. For example, if you have
a database containing a mailing list, you should be able to write
information for each person in the list, with fields delimited by a
unique character such as a vertical bar (|) to a file. The following
is an example of a merge data file:

	 -------------------------------------------------------
	| Doe|John|Inc Inc.|123 A St.|Big City|BC|99998		|
	| Doe|Jane|Company Inc.|456 B St.|Little City|LC|99999	|
	 -------------------------------------------------------

3) map file - this is an ASCII text file which defines the
relationships between the relative field position of data in the merge
data file and the user variables used in the template document. The
entries in this file have the following format:

1=variable_name1
2=variable_name2
        .
        .
        .
n=variable_namen

The following is an example of a map file:

	 -------------------------------------------------------
	| 1=$lname						|
	| 2=$fname						|
	| 3=$company						|
	| 4=$address						|
	| 5=$city						|
	| 6=$state						|
	| 7=$zip						|
	 -------------------------------------------------------
	

The field numbers must always start with 1, and the numbers must
continue sequentially.

fmmerge will produce a document for each record in the merge data
file. From the examples given above there will be a document for both
John Doe and Jane Doe.  You have the option to print and/or save these
documents.

Installing fmmerge
------------------
To install fmmerge, copy fmmerge to the $FMHOME/bin directory.

Running fmmerge
---------------
To run fmmerge, type fmmerge [name]. Name is an optional argument that
allows you to specify the basename of the three input files.  i.e.
fmmerge merge would assume that you wish to use merge.doc,
merge.dat, and merge.map as the template, merge data, and merge map
files.

Options
-------
You may also use the following options on the command line.  These
options allow you to customize the running of fmmerge

-d filename	This option allows you to specify the name of the
		merge data file.  The default is merge.dat.

-help		This option will result in the display of a short help
		summary.

-m filename	This option allows you to specify the name of the
		merge map file.  The default is merge.map.

-n		This is the "no save" option. Use this if you do not
		want to save the documents produced by fmmerge.
		Normally, this option will be used in conjunction with
		the -p option when you want to print the documents
		without saving them.

-p		This option will cause fmmerge to print each document
		that it produces.

-s character	This option allows you to specify the separator
		character used to delimit fields in the merge data
		file.

-t filename	This option allows you to specify the name of the
		template file. The default is merge.doc.

Aaron L. Hoffmeyer
TR@CBNEA.ATT.COM