###   Projekte und Informationen rund um den KC85   ### 

 

CFOG's PIP, May 1986, Volume 4 No. 7, Whole No. 43, page 7

Mail Merge Tip -- Combining .AV and .DF commands

by Jack Snarr

Every WordStar book shows how to use MailMerge to address envelopes to a list of correspondents. The basic idea is to use the "data file" command (.DF) to specify the data file in which the names and addresses are stored, and the "read variable" command (.RV) to extract the variables. Very simple! But, what if you use multiple mailing lists (data files) from time to time? At least four alternatives exist:

1. Write a separate MailMerge command file for each, specifying the corresponding data file after .DF in each. This will quickly clutter a diskette with many virtually identical files.

2. Maintain one command file, but edit the the ".DF" each time a different group of addresses is desired. This saves disk space at the cost of repeated loading and editing.

3. Incorporate an "ask variable" (.AV) to request key board entry of the desired data file, then transfer that file name to .DF as a keyword, i.e., .DF &datafile&.

This is a step in the right direction, but surprisingly, when the job is run the data file name request is repeated with each step through that data file! Evidently, .DF recycles an entire command sequence with each step, including any .AV commands. Obviously this isn't the solution.

4. The answer is to use the file insert (.FI) command to chain two command files together: one to request the data file name, and the other to sequence the addressing.

(a) The first:

..ENV
.AV "Name of data file",DATAFILE
.FI ENV2

(b) The second:

..ENV2
.OP
.PO 30
.DF &DATAFILE&
.RV Name,Address,CitySTZIP
&Name&
&Address&
&CitySTZIP&
.pa

Once ENV and ENV2 are written, the user needs only to enter M ENV<cr> and when prompted, the name of the data file desired. Only ENV2 will be recycled.

Use the same approach to supply the heading and greeting to a merge letter sent on occasion to different groups of people.