home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / wp_dbase.zip / WPMERGE.DOC < prev    next >
Text File  |  1986-09-05  |  16KB  |  378 lines

  1.  
  2.                               WPMERGE
  3.  
  4. Version 1.0
  5. October 1986
  6.  
  7. ********************************************************************
  8. * Copyright 1986 by    Stuart Ozer                                 *
  9. *                      Cursor Left Software                        *
  10. *                      182 East 7th Street, #3-S                   *
  11. *                      New York, NY  10009                         *
  12. *                                                                  *
  13. *   USER-SUPPORTED SOFTWARE.  Please copy and distribute this      *
  14. *   program!  If you find this product useful, please send $25     *
  15. *   (checks only, please, payable to Stuart Ozer) to the address   *
  16. *   above.  You will be notified of future Dbase III Plus          *
  17. *   utilities and receive support and upgrade announcements        *
  18. *   for this product.                                              *
  19. *                                                                  *
  20. *   Your comments and suggestions are appreciated!                 *
  21. *                                                                  *
  22. ********************************************************************
  23.  
  24.    A utility program running under Dbase III Plus to convert
  25.    Dbase data into WordPerfect format for mail-merge
  26.    applications.
  27.  
  28.    Features:
  29.  
  30.    * Emulates DBASE Label Form system to define output data
  31.    * Menu-driven, with help.
  32.    * Can output data from multiple related DBASE fields into one
  33.      WordPerfect merge file.
  34.    * Can create multiple line WordPerfect fields, with blank
  35.      lines suppressed.
  36.    * Creates custom DBASE programs to output particular merge
  37.      files.  You can incorporate these programs into your own
  38.      applications.
  39.    * Saves merge file definitions for future use or modification.
  40.    * Output is WordPerfect ready.  No additional conversion is
  41.      needed.
  42.  
  43.  
  44. 1.  CONTENTS & INSTALLATION
  45.  
  46.     The complete WPMERGE package includes the following files:
  47.  
  48.     WPMERGE.PRG  (The DBASE program file)
  49.     WPMERGE.DEF  (A necessary definition file)
  50.     WPMERGE.DOC  (This document)
  51.  
  52.     Place WPMERGE.PRG and WPMERGE.DEF in your Dbase III+ directory.
  53.  
  54.     Since you will probably want to use WPMERGE when working in
  55.     another directory, be sure that you have a file CONFIG.DB in
  56.     your DBASE III+ directory, and that it contains the command:
  57.  
  58.              PATH=<directory list>
  59.  
  60.     with the DBASE III+ directory included in <directory list>.  See
  61.     your DBASE manual for details on the CONFIG.DB file.
  62.  
  63.  
  64. 2.  HOW WPMERGE WORKS
  65.  
  66.     WPMERGE expects you to have DBASE files already filled with data
  67.     to convert into WordPerfect format.  WPMERGE will not disturb
  68.     data in existing files, but will write new data files that can be
  69.     used with your word processor.
  70.  
  71.     WPMERGE will create the following types of files:
  72.  
  73.     <filename>.SF   --  Data file compatible with WordPerfect merge
  74.                         format.  ('SF' stands for Secondary File in
  75.                         WordPerfect lingo.)
  76.  
  77.     <filename>.WPM  --  Saved definitions for a creating a
  78.                         particular WordPerfect merge file.   WPMERGE
  79.                         remembers previous merge formats you've
  80.                         designed. (These are analogous to .LBL files
  81.                         which define a label format in DBASE.)
  82.  
  83.     <filename>.PRG  --  WPMERGE writes a DBASE III + program for
  84.                         each particular merge file you define, and
  85.                         gives you the option of naming and saving
  86.                         the program.  This program can be run to
  87.                         create a merge file in the future without
  88.                         using WPMERGE by typing  DO <filename>.  You
  89.                         can also incorporate the .PRG program into
  90.                         other programs of your own.
  91.  
  92.  
  93.     DBASE and WordPerfect maintain data in different formats.  Here
  94.     are the main differences, and what WPMERGE does about them:
  95.  
  96.     A.  Dbase fields have a fixed length.  WordPerfect fields
  97.         have variable length.  So WPMERGE trims trailing blanks.
  98.  
  99.         Suppose you want to merge a first name into a letter.  A
  100.         line in your letter might be:
  101.  
  102.                      Dear ^F2^,
  103.  
  104.         Where ^F2^ is the WordPerfect merge code for the first data
  105.         field (in this case containing first name).  Each first name
  106.         in the DBASE file probably includes several blank spaces at
  107.         the end. This would be a disaster in WordPerfect, because
  108.         the comma after Dear <name> would then be separated from the
  109.         name.
  110.  
  111.         To prevent this problem, WPMERGE automatically TRIMS
  112.         trailing blanks from each line in the resulting WordPerfect
  113.         merge file.
  114.  
  115.     B.  WordPerfect allows fields that take up more than one line,
  116.         unlike DBASE.  So WPMERGE allows you to construct multiple-
  117.         line fields, and suppresses blank lines.
  118.  
  119.         In Wordperfect, a complete address block can be treated as
  120.         one field.  For example, a letter heading in WordPerfect
  121.         might look like:
  122.  
  123.              January 15, 1987
  124.  
  125.              ^F1^
  126.  
  127.              Dear ^F2^,
  128.  
  129.         Here, ^F1^ is the merge code for a multiple-line name and
  130.         address block.  Some addresses might have a "care-of" line
  131.         or other optional address, other may not.  So ^F1^ may have
  132.         a variable number of lines.  WPMERGE allows you to define
  133.         multiple-line WordPerfect merge fields, and automatically
  134.         eliminates blank lines in the middle of a multiple-line
  135.         WordPerfect field.
  136.  
  137.  
  138. 3.  START WPMERGE
  139.  
  140.     Set up your work areas as though you were about to generate
  141.     labels -- i.e. USE one or more files of your choice, along with
  142.     any needed index;  SET FILTER to any filter condition you wish,
  143.     and SET RELATION if you wish to access data from more than one
  144.     database in use.
  145.  
  146.     If you are using multiple files, be sure that your primary data
  147.     file is in work area 1.  In addition, work are 9 is reserved for
  148.     WPMERGE, so leave it empty.
  149.  
  150.     We suggest that you start WPMERGE from the directory containing
  151.     your DBASE file.  When your files are set up as you wish, type:
  152.  
  153.             DO WPMERGE
  154.  
  155.     You may abort WPMERGE at any time by typing the <esc> key,  No
  156.     files will be damaged.  Simply answer "Y" to the Cancel? prompt.
  157.  
  158.     After you start WPMERGE, the name of the primary file in use (the
  159.     file in work area 1) will be displayed, and WPMERGE will ask you
  160.     to verify it is correct.
  161.  
  162. 4.  NAME A MERGE DEFINITION FILE
  163.  
  164.     WPMERGE will display a list of .WPM files in your current
  165.     directory.  These contain information about previous merge files
  166.     you've defined using WPMERGE.  To perform a previously defined
  167.     merge file creation, or edit a definition, type one of the
  168.     names (if any) displayed on the screen.  Enter the first name
  169.     only, not ".WPM".
  170.  
  171.     If you want to define a new merge file, enter a new name, and
  172.     confirm by typing "Y" at the NEW DEFINITION? prompt.
  173.  
  174.     (NOTE:  WPMERGE will not permit you to give a merge definition the
  175.     same first name as a DBASE file in use.)
  176.  
  177.     If you are re-creating a previously defined merge file, WPMERGE
  178.     will give you the option of bypassing the definition display /
  179.     edit screen described below.
  180.  
  181.  
  182. 5.  CREATE / EDIT A MERGE FILE DEFINITION
  183.  
  184.     The bottom two lines of the screen will always display the
  185.     keyboard options available to you at any point.
  186.  
  187.     Initially, the top portion of the screen will display the first
  188.     20 field names and types (Character, Numeric, Logical, Date or
  189.     Memo) available in the primary database.
  190.  
  191.     Use the HELP  (<control><home>) command, and help option 1, to
  192.     obtain a list of all field names in all open files.
  193.  
  194.     HELP also provides a brief summary how to use WPMERGE.
  195.  
  196.     The middle part of the screen is the main work area.  It lets
  197.     you enter the DBASE expressions for the contents of every line
  198.     to be sent to a WordPerfect merge file.
  199.  
  200.     The left column displays the line number of each line in the
  201.     merge file being defined.  The WordPerfect merge file you define
  202.     may contain an unlimited number of fields for each record.
  203.  
  204.     Use <up-arrow> and <down-arrow> to move the curser to any line
  205.     of the definition screen, and hit <return> to enter data on the
  206.     line you are pointing to.
  207.  
  208.     In the highlighted area labelled CONTENTS OF LINE, type the
  209.     DBASE expression for the line.  For example, for a DBASE file
  210.     containing City, State and Zip fields, the last line of a
  211.     WordPerfect address field would be defined as:
  212.  
  213.             trim(city) + ", " + state + "   " + zip
  214.  
  215.     The contents of each line must be a character expression.
  216.     WPMERGE will check the validity of what you type, and force you
  217.     to reenter any bad definition or non-character expression.  To
  218.     insert numeric or date data, you must use the conversion
  219.     functions STR() or DTOC() respectively.  Memo fields won't work.
  220.  
  221.     You may include data from other related files in use by using
  222.     the relational operator ( -> ) in line expressions, just as you
  223.     would in report or label forms:
  224.  
  225.             <alias name> -> <related file field name>.
  226.  
  227.     After entering the contents of a line, you must tell WPMERGE
  228.     whether or not that is the end of a WordPerfect merge field.  If
  229.     you wish to enter more lines for a multi-line field, enter 'N'
  230.     for END OF WP FIELD?  If you are done, or if the next line you
  231.     wish to define starts a NEW field in WordPerfect, answer 'Y'
  232.     here.
  233.  
  234.     Just as in the CREATE LABEL command, WPMERGE expects to move
  235.     the cursor up or down after entering each line, and then to hit
  236.     <return> to enter information on a line you are pointing to.
  237.  
  238.     If your merge file definition is more than 12 lines long,
  239.     WPMERGE will present you with a fresh screen to work on if you
  240.     move the cursor <down-arrow> after the 12th line.
  241.  
  242.     When you are done defining all lines, type <end> or <page-down>.
  243.  
  244.  
  245. 7.  CREATING THE MERGE DATA FILE
  246.  
  247.     You will be asked to name a new WordPerfect Merge Data File to
  248.     store your DBASE data in WordPerfect format:
  249.  
  250.       Enter a name (or path) for WordPerfect Merge Data File: <name>.SF
  251.  
  252.     The filename automatically includes ".SF" as its extension (or
  253.     second name). ".SF" stands for Secondary File in WordPerfect
  254.     lingo.  If the full name (including path) takes up more space
  255.     than is displayed, the name will scroll.  If you do not include
  256.     a path, the file will be saved in the current directory.  Do
  257.     not type the extension ".SF", it is automatically included in
  258.     the name.
  259.  
  260.     If a WordPerfect data file of the same name already exists, you
  261.     will be warned and asked to confirm the name.    WPMERGE then
  262.     creates a small DBASE III + program to perform the actual
  263.     conversion from DBASE to WordPerfect of the particular file and
  264.     merge structure you are working with.
  265.  
  266.     You are now given the chance to permanently save the program
  267.     which WPMERGE writes:
  268.  
  269.          Do you want to save the merge program? [Y/N]  <y/n>
  270.  
  271.     Answering [Y]es will allow you to produce an identically defined
  272.     merge file in the future WITHOUT using WPMERGE.  If you answer
  273.     [N]o, WPMERGE will STILL remember how you created this
  274.     particular merge file, and you will be able to repeat the same
  275.     process in the future.  The only difference is that you will
  276.     have to use WPMERGE to retrieve the merge file definition you've
  277.     created, rather than run the stand-alone DBASE program which
  278.     WPMERGE has just created.
  279.  
  280.     If you are developing a DBASE III + application, you may wish to
  281.     save the program DBASE writes.  You can then incorporate it in
  282.     your system to perform the particular data translation you've
  283.     defined.
  284.  
  285.     Before performing the actual merge file creation, WPMERGE asks
  286.     you again if you wish to proceed:
  287.  
  288.          Create WordPerfect Merge Data File? [Y/N]  <y/n>
  289.  
  290.     Answering [N]o at this point avoids building the actual
  291.     WordPerfect file, while still preserving the merge file
  292.     definition and the DBASE program to perform the merge in the
  293.     future.  Answering [Y]es proceeds with constructing the
  294.     WordPerfect file.
  295.  
  296.     As the WordPerfect data file is being creating, a message
  297.     displays the number of records which have been converted.   The
  298.     process is not fast on a PC, but no other conversion method is
  299.     quicker or more straightforward.
  300.  
  301.     During WordPerfect Merge File Creation, hitting <esc> will allow
  302.     you to abort the process.
  303.  
  304. 8.  TO RUN A SAVED PROGRAM
  305.  
  306.     Open all necessary data and index files.  Set filters and
  307.     relations as needed.  Then type
  308.  
  309.                           DO <filename>
  310.  
  311.     where <filename> is the name of a previously saved merge file
  312.     creation program.  The program may be incorporated into other
  313.     DBASE programs which you write.
  314.  
  315. 9.  EXAMPLES
  316.  
  317.  
  318.     EXAMPLE 1:
  319.  
  320.          Your DBASE file contains fields FIRSTNAME, LASTNAME,
  321.          SALUTATION, COMPANY, OPTIONAL, STREET, CITY, STATE, ZIP,
  322.          PROD_CODE
  323.  
  324.          Where SALUTATION contains "Ms.","Mr.", or "Dr."  and
  325.          PROD_CODE contains a code for product "V" for Vacuum
  326.          Cleaner or "C" for Computer
  327.  
  328.          You want to create a WordPerfect Merge file containing an
  329.          ^F1^ = Address Block
  330.          ^F2^ = Full Salutation  (i.e. "Ms. Smith")
  331.  
  332.           The merge file definition will look like this:
  333.  
  334.  
  335.        Contents of merge data file (by line):            End of WP field?
  336.   1    trim(salutation)+" "+trim(firstname)+" " +lastname       N
  337.   2    company                                                  N
  338.   3    optional                                                 N
  339.   4    street                                                   N
  340.   5    trim(city)+", "+state+"  "+zip                           Y
  341.   6    trim(salutation)+" "+lastname                            Y
  342.  
  343.          The first five lines define the address block field, line 6
  344.          is the full salutation.  Blank lines will be suppressed in
  345.          the WordPerfect file -- some addresses will have 4 lines,
  346.          others will have 5.
  347.  
  348.     EXAMPLE 2:
  349.  
  350.     In the example above, the DBASE file includes a product code.
  351.     WPMERGE cannot substitute a full product name for a code, but
  352.     WordPerfect certainly can.
  353.  
  354.     So, if you wanted to make reference to the coded product in your
  355.     personalized letter, include the product code and a "tagword" in
  356.     your merge file definition.  Then, in WordPerfect, search-and-
  357.     replace the tagword-code combination with the full product name.
  358.     In the example above, add a line 7 in the merge definition:
  359.  
  360.         7    "product:"+prod_code                          Y
  361.  
  362.     The text "product:" serves as the tagword, and will be followed
  363.     immediately by the product code in the merge file.
  364.  
  365.     After WPMERGE creates the merge file, call it up in WordPerfect
  366.     and perform a search & replace <alt>-F2 :
  367.  
  368.         srch->: product:V
  369.         replace with: Vacuum Cleaner
  370.  
  371.         srch->: product:C
  372.         replace with: Computer
  373.  
  374.      The merge file now contains the full text of your product name
  375.      in each record.  So, performing a Wordperfect merge now will
  376.      insert the full name for the products into your letters.
  377.  
  378.