Form Letters

With Con-form you are able to extract data from Adabas files and thus to automatically create documents which contain the extracted data. To do so, you must create a Natural program which makes use of the COMPOSE statement (see the Natural documentation for further information).

This document covers the following topics:


Using the COMPOSE Statement

The following example shows one of several possible ways to perform mass mailing. It is assumed that you work with Con-nect on a mainframe (see the Con-nect User's Guide for information regarding procedures and documents).

To create a form letter, you can proceed as follows:

  1. Create a Natural program to extract data from the database.

    The Natural program must contain the name of the Adabas file and the fields to be used from that file. Furthermore, the Natural program must contain the COMPOSE ASSIGNING statement; for example:

    COMPOSE ASSIGNING
        'SALUT' = SALUTATION
        'NAME' = LASTNAME
        'STREET' = STREET
        'TOWN' = CITY

    The ASSIGNING clause assigns values to the Con-form variables being used in your document. The operands on the left side of the equal sign (enclosed in single quotes) are the variable names that you use in your document. The operands on the right side of the equal sign are the fields being extracted from Adabas.

  2. Create a document in Con-nect using the command sequence "ADD Document". This is the skeleton for your form letter containing the text and the variables to be substituted with information from the Adabas file.

    .LM 0;.RM 60
    &salut &name
    &street
    &town
    .SL
    Dear &salut &name.,
    .SL
    .LM 0;.RM 60
    Your subscription with MAGNIFICENT WILDLIFE magazine will soon expire.
    If you act now and renew your subscription for one full year, you will receive
    a 40% discount - a savings of $25.00 off the newsstand price!
    .SINCERELY

    Note:
    The macro .SINCERELY in the above example has been defined in the FPROFILE.

  3. Use the command sequence "ADD Procedure" to define the Natural program to Con-nect.

  4. Use the command sequence "INFO Document document-name" to link the procedure to the Con-nect document. Define the procedure as a pre-formatting procedure.

  5. FORMAT the document.

    Caution:
    When you use the FORMAT command in Con-nect, the procedure must not contain COMPOSE statements with clauses other than ASSIGNING or EXTRACTING.

Testing Your Form Letter

The following is an example of a form letter which produces different results depending on whether the addressee is female or male. The example also illustrates the advantage of the .SV instruction. It is helpful when you want to test whether your form letter produces the desired results before you have the variables replaced with data from the database.

.LM 0;.RM 60
.FI ON;.JU ON
.SV sex=F
.SV salut=Ms.
.SV name=Smith
.SV street=451 Sundown Drive
.SV town=Reston, VA 22091
.SV magname=MAGNIFICIENT WILDLIFE
.** The above variables are helpful, when you want to test
.** whether your form letter produces the desired results.
.** To replace the variables with information from your database, you
.** must create a Natural program which uses the COMPOSE statement.
.** When you replace the variables with information from your database,
.** you must erase the above .SV instructions.
.IF &sex = M
.TH
.SV newmag=FOOTBALL HIGHLIGHTS
.SV text1=highlights from the most recent games
.SV text2=the latest news of the hottest players of the season
.SV phone=FOOT
.EL
.SV newmag=HEALTHY LIVING
.SV text1=new discoveries from the research laboratories, diet tips
.SV text2=recipes which incorporate the latest health findings
.SV phone=HEAL
.EI
&salut &name.$
&street.$
&town.$
.SL 3
.RA ON
&$MN &$DA., &$CN.&$YE
.RA OFF
.SL 3
Dear &salut &name.,
.SL
Your subscription with &magname magazine will soon expire. If you
act now and renew your subscription for one full year, you will receive
a 40% discount - a savings of $25.00 off the newsstand price!
You are a valued customer of ours and we would hate to have you miss
this opportunity.
.SL
Additionally, we are introducing a new magazine called &newmag
which offers &text1 and &text2..
If you are interested in our newest magazine, simply fill out the
form below along with your renewal information or call our toll-free
number 800-766-&phone..
.SL
Sincerely,
.SL 4
J. Baker$
Vice President of Sales

The above instructions cause the following formatted output:

Example for form letter

When the variables "sex" and "salut" of the above Con-form document contain the values below, the formatted output contains a different version:

.SV sex=M
.SV salut=Mr.

In this case, the formatted output looks as follows:

Example for form letter

Dialog Mode for Input

This mode allows the interaction between a Natural program and a text formatter while formatting the input data. A Natural program is thus able to supply raw text as input to Con-form.

.TE - Terminal Input

.TE ON
.TE OFF

The .TE instruction can only be used in conjunction with Natural's COMPOSE statement.

.TE ON is defined in the Con-form document. This instruction breaks the formatting process and activates text input from the terminal.

.TE OFF is defined in the Natural program with the COMPOSE MOVING statement. This instruction stops text input from the terminal, and Con-form continues the formatting process.

For an example illustrating the dialog mode for input, see the description of the COMPOSE statement in the Natural documentation.