Mail merge with Quill, a powerful feature for an historical software

While it’s true that Quill is really obsolete as a word processing software (even on the QL there’s something better, like Text87 or Paragraph), this old glory still can be used with satisfying results, thanks to its solidity, but also due to its powerful features. (This of course is related to the XChange version of Quill).

In this issue we will talk about the MAIL feature, which allows the “mail merge” operation.
For those who don’t know what I’m talking about, this feature allows associating a document with an input list and automatically creating a series of documents, with some parts coming directly from said list.

The most obvious case is writing multiple letters to more than one destination address, but this options allows powerful manipulation of the text making it possible to achieve unexpected features – mostly unexpected in such an old software.

The MAIL command is present in the Files command. Let’s begin with the “multiple letters” task to make an example, even if we said before that many different tasks can be completed.

The Mail command requires two information sets. The first set is the document (template), which contains the fixed parts of our document series, while the second set is the list of variable data which we will use to create the actual documents.
These data can be simple names, or entire paragraphs itself.

Inside the template, every position where to insert the variable data we want is marked with a specific pointer.

The second information set is the list of the variable data to associate with the template. The mail option will insert all these data on the markers inserted into the template, and will print a copy of the document for every item of the list.

Before starting a more serious use of the Mail option, I strongly suggest trying with simple data, in order to acquire some confidence with the mechanism.

The template

The template is a common Quill document. For every position in the document where you want a variable data to be inserted, you just have to write the corresponding field name followed and preceded by a delimiter character: for Quill this character is the asterisk “*”.

Suppose you are writing a letter which you want to send to several destinations. The main text is the same, but you just want every single copy to include the address of the actual recipient. The letter may look similar to this:


QL Magazine
Just some address, 1
10100 Torino

*title* *name* *familyname*
*zip* *town*

Messrs. *title* *familyname*,

With the present, blah blah blah yadda yadda  yadda
some other words together with more nag blah blah  blah
and then other useless words  which we just love to put
on screen because blah blah blah blah blah blah blah so
blah blah blah blah

In conclusion,  more blah blah blah  and even  more
nag nag nag yadda yadda yadda and how much we just love
to write useless words?

Kind regards
Your beloved sender


The text objects between asterisks represent the variable data which will be substituted by list elements. Of course the asterisk will be deleted from the printed document.

If you want to use a different marker (because e.g. you need to print asterisks in your text, or just because), you can specify a new marker writing it down as the first character into the data file.

It is possible to declare up to thredd different methods to insert your data into the template: you can use the keyboard, another Quill document or an external file in _exp format.

1 – Using the keyboard

This is the simplest but more time consuming method.
After creating the template, with all the relevant variable fields, select the Mail option from the Mail command writing :

F3 O F M

then press ENTER to accept what Quill suggest to input via the keyboard. Quill will then suggest to send copies to the printer; you can accept the request pressing ENTER.
You can alternatively write the result on a _lis file, writing down its name before pressing ENTER.

For every variable field, Quill will show the relevant position and will ask to write the corresponding data.
Press Esc any time you finish substituting; after reaching the document end, Quill will ask to confirm that inserted data are correct. Press “Y” to confirm or “N” to cancel.

Quill will then ask to press “C” to continue or “ENTER” to end editing. Pressing “C” the process will start again.

2 – Using another document.

It is possible to create another document, containing the variable data to be inserted into the template.
The first paragraph of this document contains the list of the names for the variable fields, separated by a specific delimiter. Every following paragraph corresponds to a record – a copy of the document.
Remember that on Quill, to finish a paragraph it is necessary to press Enter.

Here is an example, took from XChange manual:

/Mr/J/Smith/53 Main Road/Anytown/Westshire/AB2 3CD/
/Mrs/A/Jones/27 Gillygate/York//YO1 1XY/

As you can see, the file begins with a separator (“/” in this case). This indicates Quill what the delimiter is – this character can’t be used as a specific data.

Save the secondary file as always:

F3 S secondfile ENTER

and load the template.
Select the Mail option from the Mail command, as explained before, but don’t accept Quill suggestion to insert data via keyboard: instead, write the name of the secondary file:

F3 O F M secondfile_doc ENTER

Remember to include the _doc extension, because Quill uses the _exp extension as default.

Just like the previous way, it is possible to directly print the output or save it on a _lis file. The entire operation will then proceed unattended.

The only exception to this is in case your template contains empty markers – “**” for example.
Quill will then alert of the problem and ask if you still want to proceed or stop.
This will occur for every copy you will want to print.

In the above written example, some fields are reported more than once. Anyway, the data must be defined just once in the secondary file: Quill will take care of the substitutions.
Variable data not present into the template will be discarded.

3 – Using an export file

The most efficient method to use the Mail option is using a PSION exchange file, a.k.a. export file (with _exp extension). The procedure is the same as using another document: the only difference is the type of the input file to use.

Where is the advantage, then?
The _exp file can be created using any program.

If you want to produce quality printouts, or complex tabulates, or need to use complex layouts subject to frequent modifications, this is the best solution available.

The _exp file can be saved with your application (which will not need to worry about page feed, line jumps etc.) while the printing phase will be taken care by Quill – maybe calling it directly from the application via a TSL.
If it’s necessary to import some modifications, it suffices to work on the Quill template, without the need to modify the software application.

Giorgio Garabello