APPLICATION NOTE #155 CONVERTING A DBASE TEXT FILE TO XYWRITE FORMAT Rev. 01 RELATED FILES: MAIL.PGM dBASE is a database management program produced by Ashton-Tate. It includes a capability for creating an ASCII text file that you can export for use with other programs. This application note describes a XYQUEST-developed program that modifies the dBASE text file to make it suitable for use with XyWrite's Mail Merge feature. dBASE TEXT FILE FORMAT Using dBASE, create an ASCII text file with the following format: /Books, Etc/,/86 Main St/,/Madison/,/AL/,35758 /The Train Store/,/26 Channel Lane/,/Chelmsford/,/MA/,01824 Notice that each record starts with a slash and ends with a carriage return. The fields in the addresses are separated by slashes and commas. PROGRAM DESCRIPTION To make it easier for you to use the dBase text file with the XyWrite Mail Merge feature, XYQUEST has developed a program that eliminates the commas and extra slashes, and produces a data file that uses a single slash as a field separator. (See Note #1.) This program, called MAIL.PGM, is available on request from XYQUEST's Technical Support department. It is also reproduced at the end of this application note. PROGRAM OPERATION To use MAIL.PGM to modify a dBase text file: 1. Copy MAIL.PGM onto your working disk or into your XyWrite directory if you have a hard disk. 2. Call the dBase text file to the screen. 3. Run the program. F5run mail.pgm Result: The text file now has the following format: Books, Etc/86 Main St/Madison/AL/35758 The Train Store/26 Channel Lane/Chelmsford/MA/01824 A slash separates the fields and a single carriage return separates the records. MAIL MERGE SEPARATORS XyWrite uses a single carriage return as the default field separator and two carriage returns as the default record separator. The data file created in the previous section has different separators. To use it with XyWrite's Mail Merge feature, you must make sure the field separators are compatible with XyWrite. You have two choices: * Change the default separators in your printer file to match your dBASE text file * Modify the separators in the dBASE text file to match the XyWrite defaults To change the default separators: 1. Create a new printer file (see Note #2). For example: Type: F5new separatr.prn 2. On the first line, enter the label that identifies the file as a printer file. Type: ;PR; 3. On the next line, enter the FS (Field Separator) command and a slash. Type: FS 4. On the third line, enter the RS (Record Separator) command and the two ASCII characters that comprise the XyWrite line return (ASCII 13 and ASCII 10). Type: RS<{ASC-13}{ASC-10} 5. Store and load the printer file, along with your regular printer file. For example: Type: F5load separatr.prn+3epsonfx.prn Result: XyWrite now recognizes a slash as the Mail Merge field separator and a single carriage return as the Mail Merge record separator. If you prefer to use the default field separators, you need to further modify the data file created by dBASE III Plus and MAIL.PGM: 1. Call the file to the screen. For example: Type: F5call mail.txt 2. Be sure the cursor is at the beginning of the file and issue a CI (Change Invisible) command to change the single carriage returns to two carriage returns (see Note #3). Type: F5ci /Cntrl-/Cntrl-Cntrl-/ 3. Move the cursor to the top of the file and change the slashes to carriage returns. Press: CtrlHome Type: F5ci !/!Cntrl-! Result: The file MAIL.TXT now uses the XyWrite default Mail Merge separators. PROGRAM CONTENT MAIL.PGM is reproduced below. If you plan to recreate this program yourself, you must follow the rules for creating a XyWrite program file. For more information, refer to Chapter 5 of the XyWrite Reference Guide. TF BC ci !/,/!/! XC TF BC ci !/,!/! XC TF BC ci !{ASC-10}/!{ASC-10}! XC TF BC se !/! XC CL <>>><>==0>>RC <><> Note #1 Blank Fields. If your dBASE text file contains blank fields, MAIL.PGM will insert double slashes (i.e., //). Note #2 Separator Printer File. You can also enter the FS< and RS< settings directly into your standard printer file. The advantage of creating a new printer file for Mail Merge separators is that you can then easily use different sets of separators for different data files. There's no need to constantly modify and load your standard printer file. However, if you are planning to use a special printer file for Mail Merge separators, be sure your standard printer file does not contain any RS< or FS< lines. Note #3 Carriage Returns on the Command Line. To enter a carriage return character on the command line: Press: Ctrl