APPLICATION NOTE #184 CREATING ASCII FILES Rev. 01 One of XyWrite's more popular features is the fact that its files are pure ASCII, which means they can be easily transferred to typesetters or other programs. XyWrite uses regular ASCII characters as its control characters, and these can be stripped easily from your file in a variety of ways. This application note discusses two methods. WHAT IS AN ASCII FILE? ASCII is an abbreviation for American Standard Code for Information Interchange. This code assigns a number to each alphanumeric character and several non-printing characters that control printers and communications devices. Its purpose is to provide a standardized machine-to-machine and system-to-system communication medium. Appendix A of the XyWrite III Plus Reference Guide lists 256 ASCII codes and the characters associated with each. The first 128 codes (ASCII 0 through ASCII 127) make up the standard ASCII character set. XyWrite uses a superset of ASCII, called IBM ASCII, which adds codes 128 through 255. Because XyWrite uses only these characters, XyWrite files are pure ASCII files. However, XyWrite interprets some ASCII characters as control characters. For example, the characters << and >> mark the start and end of formatting commands. (See "XyWrite Control Characters" for more information.) Other word processors are able to display these characters, since they are ASCII characters, but they cannot interpret them as control characters. When you transfer a XyWrite file to another application program, the formatting commands display as if in XyWrite's expanded mode. Therefore, it is usually desirable to remove XyWrite commands from your file before exporting it to other software programs. REMOVING XYWRITE COMMANDS If your XyWrite file contains no formatting triangles or mode commands, it is already a pure ASCII file that can be read by another application program that accepts ASCII files. If your file does contain formatting commands, we recommend that you remove them before exporting the file. If the commands are all simple ones (no running headers, running footers, column tables, or footnotes), and you do not want to retain any formatting, use Method #1 described below. If your file is more complex, or if you need to retain formatting or disable wordwrap, use Method #2. Method #1: No Formatting Retained Often the file you need to convert to pure ASCII is a simple text file with some basic XyWrite margin commands and mode changes. A single Change command can remove all XyWrite formatting commands from this type of file, leaving you with only wordwrapped text in paragraph format. To execute this command: 1. Position your cursor at the top of the file. Press: Ctrl Home 2. Go to expanded mode. Press: Ctrl F9 3. Issue the Change command. Type: F5ci /<>// (To enter << and >>, press Ctrl < and Ctrl >, respectively. To enter the W, press Alt Shift W.) 4. Return to normal mode. Press: Ctrl F9 Result: The displayed file is pure ASCII, with wordwrapped text. Method #2: Formatting an ASCII File Sometimes you need to prepare an ASCII file differently. For example, you might need to disable wordwrap by placing a hard return at the end of each line. Or you might have a text file that contains some nested formatting commands (for instance, a running header with a page number command inside it). Or perhaps you want to convert XyWrite counters into actual numbers, or XyWrite margin units into blank spaces. In all of these instances, STRIP.PRN can help. STRIP.PRN is a special printer file that removes all XyWrite formatting from a file. This file, which is on the master XyWrite Printer File disk, can be configured to˙20either retain or disable wordwrap (see Note #1). In addition, STRIP.PRN makes the following conversions: * Converts XyWrite margin, offset, tabs and indents into a corresponding number of blank spaces. (For example, LM 5 is converted to five blank spaces at the start of every line.) * Converts running headers, running footers, footnotes, soft date (DA), soft time (TM) and page numbers into fixed text. * Removes all mode commands and places all text in normal mode. To use STRIP.PRN to format your files, load it into memory as you would any other printer file: Type: F5load strip.prn Then use XyWrite's TYPEF (Type to File) feature to prepare a pure ASCII version of your text file on disk. The form of the TYPEF command is: TYF filename,newfilename If you do not specify a newfilename, XyWrite names the new file FO.TMP. When you are finished creating the pure ASCII versions of your text files, be sure to reload your standard printer file. XYWRITE CONTROL CHARACTERS XyWrite interprets certain ASCII characters as XyWrite control codes rather than as regular ASCII characters. Most familiar of these control codes are the XyWrite open and close command marks, which appear in expanded mode as European quotes (<< >>). Another example is the tab character (ASCII 9). XyWrite interprets this character as "move to the next tab stop," rather than as just another character to be placed in the text. Similarly, the word space (ASCII 32), hyphen (ASCII 45), and period (ASCII 46) are interpreted as places where a soft line ending can occur. If you need to place one of these special characters in the text without having XyWrite interpret it, you must enter it by typing its ASCII number while holding down the Alt and Shift keys, or the Alt and Ctrl keys. When you enter one of the control characters in this way, XyWrite places an ASCII 255 in front of it, so that it no longer functions as a control code. For instance, to put a tab character (ASCII 9) in the text so that XyWrite does not interpret it as "move to the next tab stop": Press: Alt Shift 9 When you release the keys, an ASCII 9 character appears in your text. The following characters are considered control characters by XyWrite: ASCII 0, 8, 9, 10, 13, 26, 27, 32, 45, 46, 174, 175, 253, 255. Note #1 Wordwrap. Wordwrap ends each line with a space rather than a return. By default, STRIP.PRN disables wordwrap and converts all line endings to hard returns. If you prefer to have the text wordwrapped, call STRIP.PRN and follow the instructions in the comments section at the top of the file. Note #2 Electronic Mail. Also on the master Printer Files disk is a file named MAIL.PRN. This file will help you format mail for transfer via MCI Mail and other electronic mail services which require certain margin settings and a hard return at the end of each line. Refer to Appendix F of the XyWrite III Plus Reference Guide for information on using MAIL.PRN Note #3 Command Line. If you try to place one of the special characters noted above on the command line by entering its ASCII number, XyWrite does not display the character. It instead displays the number in hexadecimal format. For instance, pressing Alt Shift 45 on the command line produces " 2D." (The blank space is the ASCII 255.) Note #4 Automatic Leading. Before using STRIP.PRN, make sure AL (Automatic Leading) is off (AL=0). ###