DBPRINT by Erik Olson, Mermaid Software Products, Largo, Florida.
Industial strength mail merge utility
Shareware version 1, basic features.

Useage: DBPRINT <dbase file>
        Uses document described in PRINT.CFG
        Prints one copy of the document for each record in the DBF file

In this document:
        PRINT.CFG - example of a merge print document
        DATABASE FIELDS - how to place merge fields in the print document
        METASTATEMENTS - reference of embedded commands
        FUNCTIONS - reference of embedded functions
        SYMBOLS - special symbols you can use
        VERSION 2 - Ordering version 2

PRINT.CFG

Here is an example of PRINT.CFG, which is used with the file TEST.DBF
-----------------------------<top of file>---------------------------------
.def date1 03/07/96
.def date2 03/21/96
.output PRN
.crlf @chr(13)
.new
~(10U~(s1p12v0s0b4101T
                @today()
~(10U~(s1p12v0s3b4101T
                                                                                        First National Bank of Marin
                                                                                        PO Box 95008-5008
                                                                                        Henderson, NV 89009-5008



                {FNAME} {LNAME}
.if @len({SUITE})
                {SUITE}
.endif
                {STREET}
                {CITY}, {STATE}  {ZIP}
.ifn {POI_LETTER}






.endif
~(10U~(s1p12v0s0b4101T

                Dear {FNAME},

                We have received your VISA Account Activator and have attempted to verify your
                information by telephone, however we have been unable to verify the following:

.if {RES_LETTER}
                        - Your principal street address.

                Please provide a copy of a recent utility or telephone bill as evidence of your residence
                address and return it to us in the enclosed reply envelope.

.endif
.if {PH_LETTER}
                        - Your home telephone number.

                Please provide us with a copy of your most recent telephone bill and return it to us in
                the enclosed envelope as soon as possible.

.endif
.if {POI_LETTER}
                        - Your income with the employer listed.

                Please return a copy of your current pay stub in the enclosed reply envelope as soon as
                possible.

                Are you in a government benefit program?  Just send us a copy of the award letter you
                received, or a copy of your most recent check or direct deposit advice.

                Are you self employed?  Please send us a copy of the first four pages of your tax return
                (FORM 1040) for the most current year.

                Do you have a pension plan or receive Trust funds?  Just send us a letter from your
                plan or a copy of your latest check or direct deposit advice.

                If you do not receive income from a source that is listed above, just send us docu-
                mentation of your particular income.
.endif

                We are looking forward to serving you as a new First National Bank of Marin VISA
                cardholder.

                Sincerely,

                New Accounts Processing

.ifn {POI_LETTER}


.endif
.if @substr({KEY},JEP)
                PLEASE NOTE - If we do not receive your response by {DATE1} we will consider
                your credit card application canceled by you.  On {DATE2} we will deduct our
                processing fee from your savings account and return the balance, if any, to you.
.else
                PLEASE NOTE - If we do not receive your response by {DATE1} we will consider
                your credit card application canceled and the processing fee deposit forfeited.
.endif
.eject

-------------------------------<end of file>-----------------------------


DATABASE FIELDS

dBASE III, dBASE IV, Foxbase, Foxplus, FoxPro, dBMan and other .DBF
compatible databases can merged with the text described in PRINT.CFG.
Any numeric, logical, or character field can be merged.

Version 2 is required for date and memo fields.

Fields can be merged with text simply be inserting the field name in
curly braces, like

        Your account is past due.  You owe us {AMOUNT} dollars !!!

Better yet, a function can change or format a field, like

        Your account is past due.  You owe us @using($#,###.##,{AMOUNT}) !!!

Finally, different parts of the letter can be printed based on the
content of fields, like
==========================================================================
.if {AMOUNT}
        Your account is past due.  You owe us @using($#,###.##,{AMOUNT}) !!!
.else
        Your account is up to date and you don't owe us anything !!!
.endif
==========================================================================

Version 2 supports arithmetic in expressions, which would allow the above
block to be improved to something like this:
==========================================================================
.if {AMOUNT} > 100
        Your account is past due.  You owe us @using($#,###.##,{AMOUNT}) !!!
..if {AMOUNT} > 1000
        Your credit line has been suspended until further notice!
..else
        Your credit will be suspended if your balance exceeds $1000
..endif
.else
        Your account is up to date and you don't owe us anything !!!
.endif
==========================================================================


METASTATEMENTS

These statements perform a physical action or control output.

        .def <variable> <value>
        assigns a value to a variable for use in text or expressions

        .eject
        inserts a form feed with no carriage return at current position
        (ejects the page)

        .if <argument>
        .else
        .endif
        creates a conditional output block.  The first block is output if
        <argument> evaluates to non-zero.  The second block is output
        otherwise.  See FUNCTIONS for examples of possible arguments.

        .ifn <argument>
        .else
        .endif
        same as above, except the first block is output if the argument
        DOES NOT evaluate to non-zero.

        .new
        clears all .def variables and conditions.

        .output <file or device>
        sets output to a file or printer.  Can be used to switch files or
        printers based on data content.

        .append
        same as .output except that data is appended to the file

        .crlf <argument>
        sets the default carriage return.  i.e.,
                .crlf @chr(13)
        or
                .crlf @chr(13)@chr(10)

        Version 2 of DBPRINT features many more useful metastatements
        including database lookups, include files, printer control and
        printer font selection.  Version 2 also supports nested if..endif
        blocks and case..endcase blocks.



        FUNCTIONS

        Functions are spread-sheet style formulas that can be embedded
        anywhere within printed text or used as arguments to metastatements.
        The format of a function is @<function>(<arguments>)


        @and(x,y) - returns 1 if x and y are both non-zero
        @asc(c) - returns the ASCII value of character c
        @caps(arg) - Returns properly capitalized string arg
        @chr(n) - returns the ASCII code of value n
        @date() - returns the current date as MM-DD-YYYY
        @dup(s,n) - returns n occurances of string s
        @environ(v) - returns the DOS environment variable v
        @fix(s,n) - returns s fixed (padded or trunked) to n chars
        @fix2(s;n) - same as above but with ; to delimit arguments
        @instr(s1,s2),@substr(s1,s2) - returns position of s2 in s1
        @left(s,n) - returns left most n characters of string s
        @len(s) - returns the length of string s
        @lower(s), @lcase(s) - returns the lower case of s
        @ltrim(s) - trims all leftmost spaces from s
        @mid(s,x,y) - returns s beginning with the char x to end or for y
        @not(arg) - returns the logical opposite of arg
        @or(arg,arg) - returns 1 if either argument is nonzero
        @right(s,n) - returns right most n characters of string s
        @rnd(n),@random(n) - returns a random number between 1 and n
        @rtrim(s) - returns s with right spaces trimmed
        @time() - returns the current time in hh:mm:ss
        @today() - returns a pretty date, like January 1, 1996
        @upper(s), @ucase(s) - returns the upper case of s
        @using(<format>,data) - returns data formatted by these rules:
                ### = numbers
                \ \ = characters between (and including) slashes
                $##,###.## = currency example
                $$###.## = currency with floating dollar sign
        @val(s) - returns the numeric value of string s

        Version 2 of DBPRINT supports full arithmetic parsing of arguments
        and more functions than you can shake a stick at, as well as
        system variables like <line>, <page>, <recno> and <reccount>.

        SYMBOLS

        Version 1 of DBPRINT has only 1 symbol, which is ~
        Any occurance of ~ is replaced with the escape character, ASCII
        code 27.  Use this code to select printer fonts or to send other
        control codes to your printer.

        Example: ~(10U~(s1p12v0s0b4101T      sets laser printer typeface
                 ~I@chr(1)                   sets IBM proprinter to draft
                 ~t1~6                       sets epson's to use graphics

        See your printer manual for a complete set of control codes
        (or "escape sequences").

        Version 2 of DBPRINT uses a lookup table for symbols and comes with
        an extensive set of tables for dot matrix and laser printer
        fonts and controls built in.



        You can get version 2 of DBPRINT for $45, which includes a printed
        manual.  Some other version 2 features are:

                Background execution under DOS, TSR swaps to EMS
                HP Laser font symbol set included
                Relational database lookups
                Suspend/Resume printing
                Concurrent output to 15 different files or printers
                Interleaved output to 15 different files or printers
                Use of Date and Memo fields
                Arithmetic parser in expressions
                Nested if..endif blocks
                Case..endcase structures
                .for statement can selectively print from DBF file
                .while statement can print a portion of DBF file
                optional display interface & progress indicators
                command-line selection of .CFG file
                .include nesting files in .CFG file

        Please include suggestions for version 3 when ordering:

            Purchase options

                C.O.D. Add $4
                Visa, MC, or check debit Accepted

                Check-debit requires complete MICR line and sample check
                number.

            Send mailing address or Compuserve account number to

                Mermaid Software Products
                10503 111th Ave N.
                Largo, FL 34642
                (813) 319-0305

                http://ourworld.compuserve.com/homepages/mermaid

                102416.473@compuserve.com or
                103604.4267@compuserve.com

