Tux on VM

Last updated on:
Sunday, July 06, 2008

Software

Information

Community

News

Fun

Credits




Valid HTML 4.01!
Linux for Big Iron
Title:
Mail merge on Linux/390 using troff
Categories/Keywords:
services: mail, merge, printer, fortran, print, troff
Contributors:
"David Boyes" dboyes@sinenomine.net
Write Up By:
"Samy Rengasamy" snrsamy@yahoo.com
If you've got the source to the Fortran program and you don't want to 
change anything, the steps will look something like this:

Step 1:
Install the gf77 compiler on Linux.

Step 2:
FTP the Fortran source to Linux and the data files and compile the 
Fortran with gf77 program. If the program uses unit number-based I/O
you'll need to read the GF77 docs to indicate how to associate files
with unit numbers, or modify the Fortran to explicitly open the file
and associate it with a unit number.

Step 3:
Run the program.

Step 4:
Print the output with LPR.

If you don't mind some additional changes (and want a nicer looking 
letter), you may want to modify your Fortran program to emit troff 
commands (troff is a text formatter like DCF) to make the letters 
and then postprocess the output file with troff.  troff will allow
you to use all the features of your printer, produce Postscript or
PCL output, and generate a lot of useful other stuff.  There are 
macro packages included with troff (I'd suggest using the mm macros-- 
they're easy and well documented.) 
Your output letter might look like:

.MT 5
.ND date of letter
.WA writers name
return address
.WE
.IA
recipients address
.IE
.LO RN " in reference string"
.LO AT attention line
.LO SA salutation
.LO SJ subject line
.LT
.P
text of the letter with .P on a line by itself between paragraphs
.FC
text of closing

and then you run the output file through the command

'troff -mm output.file | dvips | lpr -Pyour fave printer' 

and you get a very nicely formatted letter to print on your
postscript printer. If you want plain text, use dvitty instead 
of dvips. The MM macros do the work of formatting and constructing 
the letter.

See the AT&T Documentor's Workshop manuals or "man mm" for details.

In fact, here's a working example:

.LO AT "Personnel"
.WA "David Boyes" "CTO"
Sine Nomine Associates
43596 Blacksmith Square
Ashburn VA 20147
.WE
.LO SA "Dear Dr. Boyes:"
.LO RN "Job"
.IA "Applicant That's Me"
Wankel Rotary Engines Inc.
55 Camelot Highway
Camelot, MA 22777
.IE
.LT
.P
.P
Here is the text of my letter. Isn't it pretty?
.P
Second paragraph. You betcha.
.P
.FC "Sincerely,"
.SG

and the output in test.out after running this file through "nroff -mm
test.in > test.out":





                                       Sine Nomine Associates
                                       43596 Blacksmith Square
                                       Ashburn VA 20147
                                       December 5, 2001

                                       In reference to: Job


       Applicant That's Me

       Wankel Rotary Engines Inc.
       55 Camelot Highway
       Camelot, MA 22777

       ATTENTION: Personnel

       Dear Dr. Boyes:
       Here is the text of my letter. Isn't it pretty?

       Second paragraph, you betcha.


                                     Sincerely,



                                     David Boyes
                                     CTO
 

Site hosting courtesy of Velocity Software