home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / file_mgt / parse_m / pom.doc < prev    next >
Encoding:
Text File  |  1995-05-02  |  82.0 KB  |  1,908 lines

  1.  
  2.     ===========================================================================
  3.     ===========================================================================
  4.     ============================                   ============================
  5.     ============================                   ============================
  6.     ============================   PARSE-O-MATIC   ============================
  7.     ============================                   ============================
  8.     ============================                   ============================
  9.     ===========================================================================
  10.     ===========================================================================
  11.                          
  12.                                                                                
  13.     +-------------------------------------------------------------------------+
  14.     |                                                                         |
  15.     |        HERE ARE A FEW OF THE THINGS PARSE-O-MATIC CAN DO FOR YOU:       |
  16.     |                                                                         |
  17.     |      Importing             Exporting             Automated Editing      |
  18.     |      Text Extraction       Data Conversion       Table Lookup           |
  19.     |      Retabulation          Info Weeding          Selective Copying      |
  20.     |      Binary-File to Text   Report Reformatting   Wide-Text Folding      |
  21.     |      Auto-Batch Creation   Comm-log Trimming     Tab Replacement        |
  22.     |      Character Filtering   Column Switching      DBF Interpretation     |
  23.     |      De-uppercasing        Name Properization    And much more!         |
  24.     |                                                                         |
  25.     |      "Parse-O-Matic is a wonderful time saver .... Each report that     |
  26.     |      I can convert from our ... accounting system saves our company     |
  27.     |      about 500 man hours per year" -- R. Brooker (a happy POM user)     |
  28.     |                                                                         |
  29.     +-------------------------------------------------------------------------+
  30.  
  31.  
  32.                    Parse-O-Matic is Copyright (C) 1992, 1995 by:
  33.  
  34.            Pinnacle Software, CP 386 Mount Royal, Quebec, Canada H3P 3C6
  35.            U.S. Office: Box 714 Airport Road, Swanton, Vermont 05488 USA
  36.  
  37.                        Support Line: (514) 345-9578
  38.                      Free Files BBS: (514) 345-8654
  39.                      Internet email: pinnacl@cam.org
  40.                      World Wide Web: http://www.cam.org/~pinnacl
  41.                          CompuServe: 70154,1577
  42.  
  43.  
  44.     +-------------------------------------------------------------------------+
  45.     |                                                                         |
  46.     |           FILE FORMATS CURRENTLY SUPPORTED BY PARSE-O-MATIC:            |
  47.     |                                                                         |
  48.     |   Input: Text (almost any format), Binary, Fixed-Length, DBF            |
  49.     |  Output: Text (flat, comma-delimited, paginated), Binary, Fixed-Length  |
  50.     |                                                                         |
  51.     +-------------------------------------------------------------------------+
  52.  
  53.  
  54.  
  55.     ===========================================================================
  56.                              AN OVERVIEW OF THIS MANUAL
  57.     ===========================================================================
  58.  
  59.  
  60.     INTRODUCTION . . . . . . . . What is Parse-O-Matic?
  61.                                  Why you need Parse-O-Matic -- an example
  62.                                  Parse-O-Matic to the rescue!
  63.                                  How it works
  64.  
  65.     FUNDAMENTALS . . . . . . . . The Parse-O-Matic command
  66.                                  The POM file
  67.                                  Padding for clarity
  68.                                  A simple example
  69.  
  70.     QUICK REFERENCE  . . . . . . Related commands
  71.                                  Command formats
  72.  
  73.     COMMAND WORDS  . . . . . . . See "Quick Reference" for list of commands
  74.  
  75.     TERMS AND TECHNIQUES . . . . Values
  76.                                  Delimiters
  77.                                  Illegal characters
  78.                                  Comparators
  79.                                  Incrementing
  80.                                  Line counters
  81.                                  Tracing
  82.                                  Quiet mode
  83.                                  DBF Files
  84.                                  Converting comma-delimited files
  85.                                  Examples
  86.  
  87.     LICENSING  . . . . . . . . . Shareware evaluation copy
  88.                                  Registered copy
  89.                                  Site and Multi-copy licenses
  90.                                  Distribution license
  91.                                  Retail license
  92.  
  93.  
  94.  
  95.     ===========================================================================
  96.                                     INTRODUCTION
  97.     ===========================================================================
  98.  
  99.  
  100.                                ----------------------
  101.                                What is Parse-O-Matic?
  102.                                ----------------------
  103.  
  104.     Parse-O-Matic is a programmable file-parser.  Simple enough for even a non-
  105.     programmer to master, it can help out in countless ways.  Here are some of
  106.     the things Parse-O-Matic can do:  Importing, Exporting, Automated Editing,
  107.     Text Extraction, Data Conversion, Table Lookup, Retabulation, Info Weeding,
  108.     Selective Copying, Binary-File to Text, Tab Replacement, Reformatting,
  109.     Wide-Text Folding, Auto-Batch Creation, Character Filtering, Column
  110.     Switching, DBF Interpretation, Report Generation, and more!
  111.  
  112.     If you have a file you want to edit, manipulate, or change around, you may
  113.     find that Parse-O-Matic is just the tool you need.  Parse-O-Matic is not,
  114.     however, an "automatic file converter".  It will not, for example, convert
  115.     WordPerfect files to MS-Word format, or convert Lotus 1-2-3 Spreadsheets
  116.     DIRECTLY to Excel files (although you CAN use Parse-O-Matic as an
  117.     intermediary, by having it read reports from one program and convert them
  118.     to comma-delimited files which can be imported by the other program.)
  119.  
  120.  
  121.                       ----------------------------------------
  122.                       Why You Need Parse-O-Matic -- An Example
  123.                       ----------------------------------------
  124.  
  125.     There are plenty of programs out there that have valuable data locked away
  126.     inside them.  How do you get that data OUT of one program and into another
  127.     one?
  128.  
  129.     Some programs provide a feature which "exports" a file into some kind of
  130.     generic format.  Perhaps the most popular of these formats is known as a
  131.     "comma-delimited file", which is a text file in which each data field is
  132.     separated by a comma.  Character strings -- which might themselves contain
  133.     commas -- are surrounded by double quotes.  So a few lines from a
  134.     comma-delimited file might look something like this (an export from a
  135.     hypothetical database of people who owe your company money):
  136.  
  137.     +-------------------------------------------------------------------------+
  138.     |      "JONES","FRED","1234 GREEN AVENUE", "KANSAS CITY", "MO",293.64     |
  139.     |      "SMITH","JOHN","2343 OAK STREET","NEW YORK","NY",22.50             |
  140.     |      "WILLIAMS","JOSEPH","23 GARDEN CRESCENT","TORONTO","ON",16.99      |
  141.     +-------------------------------------------------------------------------+
  142.  
  143.     Unfortunately, not all programs export or import data in this format.
  144.     Even more frustrating is a program that exports data in a format that is
  145.     ALMOST what you need!
  146.  
  147.     If that's the case, you might decide to spend a few hours in a text editor,
  148.     modifying the export file so that the other program can understand it.  Or
  149.     you might write a program to do the editing for you.  Both solutions are
  150.     time-consuming.
  151.  
  152.     An even more challenging problem arises when a program which has no export
  153.     capability does have the ability to "print" reports to a file.  You can
  154.     write a program to read these files and convert them to something you can
  155.     use, but this can be a LOT of work!
  156.  
  157.  
  158.                             ----------------------------
  159.                             Parse-O-Matic to the Rescue!
  160.                             ----------------------------
  161.  
  162.     Parse-O-Matic is a utility that reads text, fixed-record-length and DBF
  163.     ("DBase") files, interprets the data, and outputs the result to a text,
  164.     fixed-length or binary file.  It can help you "boil down" reports into
  165.     their essential data.  You can also use it to convert NEARLY compatible
  166.     import files, or generate printable reports.
  167.  
  168.  
  169.                                     ------------
  170.                                     How It Works
  171.                                     ------------
  172.  
  173.     You need three things:
  174.  
  175.     1) The Parse-O-Matic program
  176.     2) A Parse-O-Matic "POM" file (to tell Parse-O-Matic what to do)
  177.     3) The input file
  178.  
  179.     The input file is usually a report from another program, a fixed record
  180.     length data file, or a DBF ("DBase") file.  We've provided several examples
  181.     of typical input files. For example, the file XMPDAT02.TXT comes from the
  182.     AccPac accounting software.  AccPac is a great program, but its export
  183.     capabilities leave something to be desired.  Parse-O-Matic can help!
  184.  
  185.     To see detailed demonstrations of how these files can be parsed, enter
  186.     START at the DOS prompt, then select EXAMPLES.
  187.  
  188.  
  189.  
  190.     ===========================================================================
  191.                                     FUNDAMENTALS
  192.     ===========================================================================
  193.    
  194.  
  195.     This documentation assumes that you are an experienced computer user.  If
  196.     you have trouble, you might ask a programmer to help you -- POM file
  197.     creation is a little like programming!
  198.                           
  199.  
  200.                              -------------------------
  201.                              The Parse-O-Matic Command
  202.                              -------------------------
  203.  
  204.     The basic format of the Parse-O-Matic command line is:
  205.  
  206.         POM pom-file input-file output-file
  207.  
  208.     Here is an example, as you would type it at the DOS command line:
  209.  
  210.         POM POMFILE.POM REPORT.TXT OUTPUT.TXT
  211.  
  212.     For a more formal description of the command line, start up POM by typing
  213.     this command at the DOS prompt:
  214.  
  215.         POM
  216.  
  217.                                     ------------
  218.                                     The POM File
  219.                                     ------------
  220.  
  221.     The POM file is a text file with a .POM extension.  The following
  222.     conventions are used when interpreting the POM file:
  223.  
  224.     - Null lines and lines starting with a semi-colon (comments) are ignored.
  225.  
  226.     - A POM file may contain up to 500 lines of specifications.
  227.       Comment lines do not count in this total.
  228.  
  229.     A POM file contains no "loops" (to use the programming term).  Each line of
  230.     the input file is processed by the entire POM file.  If you'd like this
  231.     expressed in terms of programming languages, here's what POM does:
  232.  
  233.     +-------------------------------------------------------------------------+
  234.     |      START: If there's nothing left in the input file, go to QUIT.      |
  235.     |             Read a line from the input file                             |
  236.     |             Do everything in the POM file                               |
  237.     |             Go to START                                                 |
  238.     |      QUIT:  Tell the user you're finished!                              |
  239.     +-------------------------------------------------------------------------+
  240.  
  241.  
  242.                                 -------------------
  243.                                 Padding for Clarity
  244.                                 -------------------
  245.  
  246.     Spaces and tabs between the words and variables in a POM file line are
  247.     generally ignored (except in the case of the "output picture" of the OUT
  248.     and OUTEND commands).  You can use spaces to make your POM files easier to
  249.     read.
  250.  
  251.     Additionally, in any line in the POM file, the following terms are ignored:
  252.  
  253.         THEN   ELSE
  254.  
  255.     Finally, the equals ("=") character is ignored if it is found in a place
  256.     where no comparison is taking place.  This will be demonstrated below.
  257.  
  258.     You can use these techniques to make your POM files easier to read.  For
  259.     example, the IF command can be written in several ways:
  260.  
  261.         Very terse:          IF PRICE = "0.00" BONUS "0.00" "1.00"
  262.  
  263.         Padded with spaces:  IF PRICE = "0.00"   BONUS   "0.00"   "1.00"
  264.  
  265.         Fully padded:        IF PRICE = "0.00" THEN BONUS = "0.00" ELSE "1.00"
  266.  
  267.     In the last example, the first equals sign ("=") is a "comparator".  (For
  268.     details about comparators, see the section entitled "Comparators".)  The
  269.     second equals sign is not really required, but it does make the line easier
  270.     to understand.
  271.  
  272.  
  273.                                   ----------------
  274.                                   A Simple Example
  275.                                   ----------------
  276.  
  277.     Let's say you have a text file called NAMES.TXT that looks like this:
  278.  
  279.                                   WILLIAMS   JACK
  280.                                   SMITH      JOHNNY
  281.                                   JOHNSON    MARY
  282.                                   :          :
  283.                            Column 1          Column 12
  284.  
  285.     Now let's say you want to switch the columns, so that the first name
  286.     appears first.  Your first step is to create a file using a text editor.
  287.     The file would look like this:
  288.  
  289.         SET    last  = $FLINE[ 1 10]
  290.         SET    first = $FLINE[12 17]
  291.         PAD    first "R" " " "10"
  292.         OUTEND |{first} {last}
  293.  
  294.     The first two lines will tell Parse-O-Matic to extract text from each input
  295.     line.  For the first line of the input file, the variable named 'last'
  296.     will be given the value "WILLIAMS  ".  You will notice there are two spaces
  297.     at the end.  That is because we take every character from position 1 to
  298.     position 10 -- which in this case includes two spaces.
  299.  
  300.     The PAD line adds enough spaces on the right side of the variable named
  301.     'first' to make sure that it is 10 characters long.  The OUTEND command
  302.     sends the two variables to the output file.
  303.  
  304.     Save the file with the name TEST.POM and exit your text editor.  At the DOS
  305.     prompt, enter this command:
  306.  
  307.         POM TEST.POM NAMES.TXT OUTPUT.TXT
  308.  
  309.     This will run the POM file (TEST.POM) on every line of the input file
  310.     (NAMES.TXT) and place the output in the file OUTPUT.TXT, which will then
  311.     look like this:
  312.  
  313.                                   JACK       WILLIAMS
  314.                                   JOHNNY     SMITH
  315.                                   MARY       JOHNSON
  316.                                   :          :
  317.                            Column 1          Column 12
  318.  
  319.     Of course, for such a simple task, it would be easier to switch the columns
  320.     yourself, using a text editor.  But when you are dealing with large amounts
  321.     of data, and want to guard against typing errors, Parse-O-Matic can save
  322.     you a lot of time, effort and risk.  It also lets you automate editing
  323.     operations that you perform frequently.
  324.  
  325.  
  326.  
  327.     ===========================================================================
  328.                                   QUICK REFERENCE
  329.     ===========================================================================
  330.  
  331.  
  332.                                   ----------------
  333.                                   Related Commands
  334.                                   ----------------
  335.  
  336.     For ease of learning, the "Command Words" section explains each command in
  337.     the following order:
  338.  
  339.  
  340.     COMMANDS WHICH WILL...              LIST OF COMMANDS
  341.     ----------------------------------  ------------------------------------
  342.  
  343.     Break up an input line into fields  SET IF PARSE
  344.  
  345.     Control processing flow             BEGIN ELSE END DONE
  346.  
  347.     Generate or control output          OUT OUTEND OUTHDG PAGELEN
  348.  
  349.     Accept or reject input              MINLEN IGNORE ACCEPT READNEXT
  350.  
  351.     Alter fields                        TRIM PAD CHANGE PROPER INSERT APPEND
  352.  
  353.     Preprocess input                    SPLIT CHOP
  354.  
  355.     Look up data in another file        LOOKUP LOOKFILE LOOKCOLS LOOKSPEC
  356.  
  357.     Perform miscellaneous functions     TRACE SETLEN
  358.  
  359.  
  360.                                   ---------------
  361.                                   Command Formats
  362.                                   ---------------
  363.  
  364.     Here is a quick-reference table of all the commands.  The following conven-
  365.     tions are used in the table:
  366.  
  367.     "var"   means a variable that is being set.
  368.     "c"     means a comparator (if omitted, defaults to "equals")
  369.     "value" means a variable whose value is being read.
  370.     Square brackets [like this] indicate optional items.
  371.                   
  372.     -------------------------------------------  ------------------------------
  373.     COMMAND FORMATS                              EXAMPLE
  374.     ===========================================  ==============================
  375.     SET      var value                           SET      name $FLINE[20 26]
  376.     IF       value c value var value [value]     IF       x = "Y" THEN z = "N"
  377.     PARSE    var value from to [control]         PARSE    x $FLINE "2*(" "3*)"
  378.     BEGIN    value c value                       BEGIN    linecntr < "3"
  379.     ELSE                                         ELSE
  380.     END                                          END
  381.     DONE                                         DONE
  382.     OUT      [value c value] |output-picture     OUT      z = "X" |{price}
  383.     OUTEND   [value c value] |output-picture     OUTEND   z = "X" |{$FLINE}
  384.     OUTHDG   value                               OUTHDG   "LIST OF EMPLOYEES"
  385.     PAGELEN  value [value]                       PAGELEN  "66" "N"
  386.     MINLEN   value                               MINLEN   "15"
  387.     IGNORE   value c value                       IGNORE   price = "0.00"
  388.     ACCEPT   value c value                       ACCEPT   $FLINE[1 3] = "YES"
  389.     READNEXT                                     READNEXT
  390.     TRIM     var spec character                  TRIM     price "R" "$"
  391.     PAD      var spec character len              PAD      sernum "L" "0" "10"
  392.     CHANGE   var value value                     CHANGE   date "/" "-"
  393.     PROPER   var [methods [exceptions-file]]     PROPER   custname "I" "XY.PEF"
  394.     INSERT   var spec value                      INSERT   price "L" "$"
  395.     APPEND   var value value [value [value]]     APPEND   name first last
  396.     SPLIT    from to [,from to] [...]            SPLIT    1 250, 251 300
  397.     CHOP     from to [,from to] [...]            CHOP     1 250, 251 300
  398.     LOOKUP   var value                           LOOKUP   phonenum "FRED JONES"
  399.     LOOKFILE value                               LOOKFILE "C:\TABLES\DATA.TBL"
  400.     LOOKCOLS value value value value             LOOKCOLS "1" "3" "8" "255"
  401.     LOOKSPEC value value value                   LOOKSPEC "Y" "N" "N"
  402.     TRACE    var                                 TRACE    price
  403.     SETLEN   var value                           SETLEN   length custname
  404.     -------------------------------------------  ------------------------------
  405.     
  406.     The commands are explained in more detail (and in the same order) in the
  407.     "Command Words" section.  A summary of the commands and default settings
  408.     appear in the comments at the beginning of the file EXAMPL04.POM.  You can
  409.     copy these comments into your own POM file as a convenient quick reference.
  410.     
  411.  
  412.  
  413.  
  414.     ===========================================================================
  415.                                    COMMAND WORDS
  416.     ===========================================================================
  417.  
  418.  
  419.                                   ---------------
  420.                                   The SET Command
  421.                                   ---------------
  422.  
  423.     FORMAT:  SET var1 value1
  424.  
  425.     SET assigns a value to a variable.  The usual reason to do this is to set a
  426.     variable from the input line (represented by the variable $FLINE) prior to
  427.     cleaning it up with TRIM. For example, if the input line looked like this:
  428.  
  429.         JOHN       SMITH     555-1234   322 Westchester Lane    Architect
  430.         |          |         |          |                       |
  431.         Column 1   Col 12    Col 22     Col 33                  Col 57
  432.  
  433.     then we could extract the last name from the input line with these two POM
  434.     commands:
  435.  
  436.         SET  NAME = $FLINE[12 21]      (Sets the variable from the input line)
  437.         TRIM NAME  "R"  " "            (Trims any spaces on the right side)
  438.  
  439.     SET would first set the variable NAME to this value:     "SMITH     "
  440.     After the TRIM, the variable NAME would have the value:  "SMITH"
  441.  
  442.     You will also use SET if you plan to include a substring of $FLINE in the
  443.     output, since the OUT and OUTEND commands do not recognize substrings after
  444.     the "|" marker, only complete variables.
  445.  
  446.  
  447.                                    --------------
  448.                                    The IF Command
  449.                                    --------------
  450.  
  451.     FORMAT:  IF value1 [comparator] value2 var1 value3 [value4]
  452.  
  453.     NOTE:    For an explanation of comparators, see the section "Comparators".
  454.              In the following explanation, we will demonstrate the command
  455.              using only the "equals" ("=") comparator.
  456.  
  457.     If value1 equals value2, var1 is set to value3.  Otherwise, it is set to
  458.     value4 (if value4 is missing, nothing is done, and var1 is not changed).
  459.     Here's an example of the IF command...
  460.  
  461.         SET  EARNING = $FLINE[20 23]
  462.         IF   EARNING = "0.00" THEN BONUS = "0.00" ELSE "1.00"
  463.  
  464.     This obtains the value between columns 20 and 26, then checks if it equals
  465.     "0.00".  If it does, the variable BONUS is set to 0.00.  If not, BONUS is
  466.     set to "1.00".
  467.  
  468.     The "THEN" and "ELSE" are "padding" and can be omitted.  For details, see
  469.     the section entitled "Padding for Clarity".
  470.  
  471.  
  472.  
  473.  
  474.                                  -----------------
  475.                                  The PARSE Command
  476.                                  -----------------
  477.  
  478.     FORMAT:  PARSE var1 value1 from to [control]
  479.  
  480.     NOTE:    PARSE is a very powerful command.  As a result, the explanation
  481.              is somewhat complex.  If you are reading this manual for the
  482.              first time, you may wish to skip this part for now, and come
  483.              back to it later.
  484.  
  485.     The PARSE command is used for extracting information from an input line
  486.     that does not have its data in precise columns.  Consider the following
  487.     input file:
  488.  
  489.                       Mouse     Gazelle   Mouse     Elephant
  490.                       Dog       Giraffe   Elk       Mongoose
  491.                       Monkey    Snake     Caribou   Trout
  492.                       |         |         |         |
  493.                       Column 1  Col 11    Col 21    Col 31
  494.  
  495.     Extracting data that is arranged in tidy columns is simple -- all you need
  496.     is the SET command.  However, you will need a more powerful command if the
  497.     data is in "free-form", like this:
  498.  
  499.                             Mouse,Gazelle,Mouse,Elephant
  500.                             Dog,Giraffe,Elk,Mongoose
  501.                             Monkey,Snake,Caribou,Trout
  502.  
  503.     The PARSE command lets you extract the "Nth" item.  For example, to extract
  504.     the third item in each line in the free-form example above, you could use
  505.     this command:
  506.  
  507.         PARSE  xyz  $FLINE  "2*,"  "3*,"
  508.  
  509.     This means "set the variable xyz by looking in $FLINE (the line just read
  510.     from the input file) and taking everything between the second comma and the
  511.     third comma".  For the three lines in the sample input file, the variable
  512.     xyz is set to Mouse, then Elk, then Caribou.
  513.  
  514.     In the "From" specification (i.e. the "2*," part of the command):
  515.  
  516.        2    means "the second occurance"
  517.        *    is a delimiter to mark the end of the occurance number
  518.        ,    is the text you are looking for
  519.  
  520.     Both the "From" and "To" specifications use this format.  Incidentally, the
  521.     text you are looking for can be more than a single character -- it can be
  522.     up to 80 characters long.  Let's say the input file looks like this:
  523.  
  524.                          Mouse:::Gazelle:::Mouse:::Elephant
  525.                          Dog:::Giraffe:::Elk:::Mongoose
  526.                          Monkey:::Snake:::Caribou:::Trout
  527.  
  528.     You can extract the third item in each line with this command:
  529.  
  530.  
  531.            PARSE  xyz  $FLINE  "2*:::"  "3*:::"
  532.                   ___  ______   _ ___    _ ___
  533.                    |     |      |  |     |  |
  534.      Variable to set     |      |  |     |  |
  535.         The value to parse      |  |     |  "To" text being sought
  536.           "From" occurance number  |     "To" occurance number
  537.             "From" text being sought
  538.  
  539.     This command sets the variable xyz to Mouse, then Elk, then Caribou.
  540.  
  541.     The PARSE command is particularly useful for extracting information from
  542.     comma-delimited files.  Here is an example of a comma-delimited file:
  543.  
  544.                         "Mouse","Gazelle","Mouse","Elephant"
  545.                         "Dog","Giraffe","Elk","Mongoose"
  546.                         "Monkey","Snake","Caribou","Trout"
  547.  
  548.     You can extract all the fields with this series of commands (note the use
  549.     of doubled-up quotes to represent a single quotation mark -- see the
  550.     section "Delimiters" for details):
  551.  
  552.         PARSE  field1  $FLINE  "1*"""  "2*"""
  553.         PARSE  field2  $FLINE  "3*"""  "4*"""
  554.         PARSE  field3  $FLINE  "5*"""  "6*"""
  555.         PARSE  field4  $FLINE  "7*"""  "8*"""
  556.  
  557.     For the first line of the sample input file, field1 is set to Mouse, field2
  558.     is set to Gazelle, and so on.
  559.  
  560.     The occurance number is not always needed.  Here are some variations of
  561.     the "From" specification that you might find helpful:
  562.             
  563.         ""      = Start from the first character in the value being parsed
  564.         "XYZ"   = Start from the first "XYZ" found in the value being parsed
  565.  
  566.     Similar variations can be used with the "To" specification:
  567.             
  568.         ""      = End with the last character in the value being parsed
  569.         "XYZ"   = End with the first "XYZ" found in the value being parsed
  570.  
  571.     The occurance number must be between 1 and 255.  The following lines are
  572.     not valid PARSE commands:
  573.  
  574.         PARSE  xyz  $FLINE  "0*,"  "1*,"      (uses 0)
  575.         PARSE  xyz  $FLINE  "1*,"  "256*,"    (uses 256)
  576.  
  577.     The occurance number is always be followed by a "*" so you can search for a
  578.     number.  Consider the following example (the meaning of which would be
  579.     unclear without the "*" delimiter):
  580.  
  581.         PARSE  xyz  "XXX2YYY2ZZZ2"  "1*2"  "2*2"
  582.  
  583.     This sets xyz to the text occuring between the first "2" and the second
  584.     "2".  In other words, xyz is set to "YYY".
  585.  
  586.     If PARSE does not find the search text, or if the "To" text occurs before
  587.     the "From" text, the variable will be set to a null ("").  Here are several
  588.     examples:
  589.  
  590.         PARSE  abc  "ABCDEFGHIJ"  "1*K"  "1*J"     (There is no "K")
  591.         PARSE  abc  "ABCDEFGHIJ"  "1*A"  "1*X"     (There is no "X")
  592.         PARSE  abc  "ABCDEFGHIJ"  "1*J"  "1*A"     ("J" comes after "A")
  593.  
  594.     The PARSE command has an optional "control" parameter, which tells PARSE
  595.     whether to include or exclude the text that was found.  By default (as
  596.     shown in all of the preceding examples), the found text is excluded.
  597.     However, if you want to include the found text, you can add "I" at the end
  598.     of the PARSE command, as in this example:
  599.  
  600.         PARSE  xyz  "aXcaYcaZc"  "2*a"  "2*c"  "I"
  601.  
  602.     This sets the variable xyz to "aYc".  You can also set the control
  603.     specification to "X" (meaning "exclude"), although since this is the
  604.     default setting for PARSE, it really isn't necessary.  Here is an example:
  605.  
  606.         PARSE  xyz  "a1ca2ca3c"  "2*a"  "2*c"  "X"
  607.  
  608.     This sets the variable xyz to "2".
  609.  
  610.     There is one exception to the behaviour of the control setting.  If you
  611.     use the null ("") specification for "From" or "To", the "found" value
  612.     (the first character for "From", or the last character for "To") will
  613.     always be included.  Here is an example:
  614.  
  615.         PARSE  xyz  "ABCABCABC"  ""  "2*C"
  616.  
  617.     This sets the variable xyz to "ABCAB".  The "From" value (i.e. the first
  618.     character) is not excluded.  However, when PARSE finds the "To" value (i.e.
  619.     the second occurance of the letter C) it is excluded.  If you want to
  620.     include the second "C", you should write the command this way:
  621.  
  622.         PARSE  xyz  "ABCABCABC"  ""  "2*C"  "I"
  623.  
  624.     The following two commands accomplish the same thing:
  625.  
  626.         PARSE  xyz  "ABCD"  ""  ""
  627.         SET    xyz  "ABCD"
  628.  
  629.     They are equivalent because the PARSE command means "Set the variable xyz
  630.     with everything between (and including) the first and last character".
  631.  
  632.     The reason that PARSE treats the null ("") specification differently may
  633.     not be immediately obvious, since the examples given here are very simple,
  634.     and not representative of "real world" applications. However, in day-to-day
  635.     usage, you will frequently find it helpful to be able to specify a command
  636.     that says, "Give me everything from the beginning of the line to just
  637.     before such-and-such".
  638.  
  639.     Here is a command that means "Give me everything from just after the dollar
  640.     sign, to the end of the line":
  641.  
  642.         PARSE  xyz  "I'd like to have $250.00"  "1*$"  ""
  643.  
  644.     This sets xyz to "250.00".  If you want to include the dollar sign, write
  645.     the command this way:
  646.  
  647.         PARSE  xyz  "I'd like to have $250.00"  "1*$"  ""  "I"
  648.  
  649.     For more examples of the PARSE command, see the demonstrations provided
  650.     with Parse-O-Matic (type START at the DOS prompt, then select EXAMPLES).
  651.  
  652.  
  653.                           --------------------------------
  654.                           The BEGIN, ELSE and END Commands
  655.                           --------------------------------
  656.  
  657.     The format for the BEGIN and END commands is as follows:
  658.  
  659.     BEGIN value1 [comparator] value2
  660.     :
  661.     Dependant code
  662.     :
  663.     END
  664.  
  665.     NOTE:    For an explanation of comparators, see the section "Comparators".
  666.              In the following explanation, we will demonstrate the command
  667.              using only the "equals" ("=") comparator.
  668.  
  669.     If value1 equals value2, then the dependant code (the POM lines between
  670.     the BEGIN and the END) are executed.  If value1 does not equal value2,
  671.     then the dependant code is skipped.
  672.  
  673.     It is traditional in programming to indent code that appears in blocks
  674.     such as Parse-O-Matic's BEGIN/END technique.  This makes the logic of
  675.     the program easier to understand.  For example:
  676.  
  677.     BEGIN datatype = "Employee"
  678.       SET phone    = $FLINE[ 1 10]
  679.       SET address  = $FLINE[12 31]
  680.     END
  681.  
  682.     BEGIN/END blocks can be nested.  That is to say, you can have BEGIN/END
  683.     blocks inside other BEGIN/END blocks.  Here is an example, with arrows
  684.     to indicate the levels of each BEGIN/END block...
  685.  
  686.     BEGIN datatype = "Employee"      <---------------------
  687.       SET phone    = $FLINE[ 1 10]                        |
  688.       SET address  = $FLINE[12 31]                        |
  689.       SET areacode = phone[1 3]                           | First
  690.       BEGIN areacode = "514"         <------- Second      | Level
  691.         SET local = "Y"                     | Level       | Block
  692.         SET tax   = "Y"              <------- Block       |
  693.       END                                                 |
  694.     END                              <---------------------
  695.  
  696.     In this case, the "inner" block (starting with BEGIN areacode = "514") is
  697.     reached only if the "outer" block (BEGIN datatype = "Employee") is true.
  698.     If the outer block is false, the inner block is ignored.
  699.  
  700.     A nested BEGIN/END block must always be completely inside the outer block.
  701.     Study the following (incorrect) example:
  702.  
  703.     BEGIN datatype = "Employee"             <----
  704.       SET phone    = $FLINE[ 1 10]              |  First
  705.       SET areacode = phone[1 3]                 |  Level
  706.       BEGIN areacode = "514"         <---       |  Block?
  707.         SET local = "Y"                 |       |
  708.     END                                 |   <----
  709.       SET tax = "Y"                     |
  710.       END                            <---  Second Level Block?
  711.  
  712.     Parse-O-Matic does not pay attention to the indenting -- it is only a
  713.     tradition we use to make the file easier to read.  The code will be
  714.     understood this way:
  715.  
  716.     BEGIN datatype = "Employee"      <---------------------
  717.       SET phone    = $FLINE[ 1 10]                        | First
  718.       SET areacode = phone[1 3]                           | Level
  719.       BEGIN areacode = "514"         <--- Second          | Block
  720.         SET local = "Y"                 | Level           |
  721.       END                            <--- Block           |
  722.       SET tax = "Y"                                       |
  723.     END                              <---------------------
  724.  
  725.     You can nest BEGIN/END blocks up to 25 deep -- although it is unlikely you
  726.     will ever need that much nesting.  Here is an example of code that uses
  727.     nesting up to three deep:
  728.  
  729.     BEGIN datatype = "Dog"           <----------------------------------
  730.       SET breed = $FLINE[1 10]                                         | First
  731.       BEGIN breed = "Collie"         <-----------------------          | Level
  732.         SET sound = "Woof"                                  | Second   | Block
  733.         BEGIN name = "Spot"          <------ Third          | Level    |
  734.           SET attitude = "Friendly"        | Level          | Block    |
  735.         END                          <------ Block          |          |
  736.       END                            <-----------------------          |
  737.       BEGIN breed = "Other"          <----------------------- Another  |
  738.         SET sound = "Arf"                                   | Second   |
  739.         SET attitude = "Unknown"                            | Level    |
  740.       END                            <----------------------- Block    |
  741.     END                              <----------------------------------
  742.  
  743.     Once again, the indentation is for clarity only and does not affect the
  744.     way the POM file runs.  However, you will find that it makes your POM
  745.     file much easier to understand.
  746.  
  747.     The ELSE command tells Parse-O-Matic to execute the following block of code
  748.     (up until the END command) if the corresponding BEGIN comparison is NOT
  749.     true.
  750.  
  751.     NOTE:  The ELSE command should not be confused with the ELSE used to pad
  752.            the IF statement (e.g. IF $FLINE[1] = "3" THEN x = "Y" ELSE "N"). In
  753.            the IF command, the ELSE is included to make the statement easier to
  754.            understand, and can be omitted (e.g. IF $FLINE[1] "3" x "Y" "N").
  755.  
  756.     The format of a BEGIN/ELSE/END block is as follows:
  757.  
  758.     BEGIN value1 [comparator] value2
  759.     :
  760.     Code that is run if the comparison is true
  761.     :
  762.     ELSE
  763.     :
  764.     Code that is run if the comparison is false
  765.     :
  766.     END
  767.  
  768.     Here is an example:
  769.  
  770.     BEGIN $FLINE[1 10] = "JOHN SMITH"
  771.       SET x = "This is John"
  772.     ELSE
  773.       SET x = "This is not John"
  774.     END
  775.  
  776.     If you are using several levels of nesting, you should indent your code to
  777.     show the relationship of the various BEGIN, ELSE and END statements.  Here
  778.     is an example:
  779.  
  780.     BEGIN datatype = "Dog"           <----------------------------------
  781.       SET breed = $FLINE[1 10]                                         | First
  782.       BEGIN breed = "Collie"         <-----------------------          | Level
  783.         SET sound = "Woof"                                  | Second   | Block
  784.         BEGIN name = "Spot"          <------ Third          | Level    |
  785.           SET attitude = "Friendly"        | Level          | Block    |
  786.         END                          <------ Block          |          |
  787.       ELSE                                                  |          |
  788.         SET sound = "Arf"                                   |          |
  789.         SET attitude = "Unknown"                            |          |
  790.       END                            <-----------------------          |
  791.     END                              <----------------------------------
  792.  
  793.     The ELSE is at "Level 2".  This is because there are three BEGINs ahead of
  794.     it, but only one END (3 - 1 = 2).  Here are two helpful rule to remember:
  795.  
  796.     - A POM file will always contain the same number of BEGINs and ENDs
  797.     - The number of ELSEs can never exceed the number of BEGINs
  798.  
  799.  
  800.                                   ----------------
  801.                                   The DONE Command
  802.                                   ----------------
  803.  
  804.     FORMAT:  DONE
  805.  
  806.     The DONE command will discontinue processing the POM file and proceed to
  807.     the next input line, whereupon the POM file will restart at the top.
  808.  
  809.     The DONE command is most useful when you have a long series of BEGIN/END
  810.     blocks which make a related comparison.  For example:
  811.  
  812.         SET   salesrep = $FLINE[11 50]
  813.         SET   region   = $FLINE[ 1  2]
  814.         BEGIN region = "US"
  815.           OUTEND |Sales representative for U.S.A.: {salesrep}
  816.           DONE
  817.         END
  818.         BEGIN region = "CN"
  819.           OUTEND |Sales representative for Canada: {salesrep}
  820.           DONE
  821.         END
  822.         BEGIN region = "EU"
  823.           OUTEND |Sales representative for Europe: {salesrep}
  824.           DONE
  825.         END
  826.         :
  827.         etc.
  828.  
  829.     As you can see, if one of the BEGIN comparisons is true, all of the
  830.     following ones will inevitably be false.  Rather than processing all the
  831.     others, you can use the DONE command to bail out and get ready for the
  832.     next input line.
  833.  
  834.     The DONE command provides two benefits:
  835.  
  836.     - It can speed up processing slightly
  837.     - It makes full traces easier to understand
  838.  
  839.     For an explanation of traces, see the section entitled "Tracing".
  840.  
  841.     The DONE command is useful only inside BEGIN/ELSE/END blocks.  If you write
  842.     a POM file like this:
  843.  
  844.         SET custnum  = $FLINE[ 1 10]
  845.         SET custname = $FLINE[11 50]
  846.         DONE
  847.         OUTEND |{custname} {custnum}
  848.  
  849.     the OUTEND statement will NEVER be reached.
  850.  
  851.  
  852.                             ---------------------------
  853.                             The OUT and OUTEND Commands
  854.                             ---------------------------
  855.  
  856.     FORMAT:  OUT[END] [value1 [comparator] value2] |output-picture
  857.  
  858.     NOTE:    For an explanation of comparators, see the section "Comparators".
  859.              In the following explanation, we will demonstrate the command
  860.              using only the "equals" ("=") comparator.
  861.  
  862.     The OUT command generates output without an end-of-line (i.e. carriage
  863.     return and linefeed characters).  The OUTEND command generates output and
  864.     also adds an end-of-line.
  865.  
  866.     When value1 equals value2, a line is sent to the output file, according to
  867.     the output picture.  Within the output picture, all text is taken literally
  868.     (i.e. " is taken to mean literally that -- a quotation mark character).
  869.  
  870.     The only exception to this is variable names, which are identified by the
  871.     { and } characters.  For example, a POM file that contained the following
  872.     single line:
  873.  
  874.         OUTEND "X" = "X" |{$FLINE}
  875.  
  876.     would simply output every line from the input file (not very useful!).
  877.  
  878.     The "X" = "X" part of the command is the comparison which controls when
  879.     output occurs.  In the example above, both values being compared are the
  880.     same, so output will always occur.
  881.  
  882.     You can not use substrings after the "|" marker.  Thus, the following line
  883.     is NOT legal:
  884.  
  885.         OUTEND $FLINE[1 3] = "IBM" |{$FLINE[1 15]}
  886.  
  887.     The correct way to code this is as follows:
  888.  
  889.         SET CODE = $FLINE[1 15]
  890.         OUTEND $FLINE[1 3] = "IBM" |{CODE}
  891.  
  892.     This outputs the first 15 characters of any line that contains the letters
  893.     "IBM" in the first three positions.
  894.  
  895.  
  896.                           -------------------------------
  897.                           The OUTHDG and PAGELEN Commands
  898.                           -------------------------------
  899.  
  900.     FORMAT:  OUTHDG value1
  901.     FORMAT:  PAGELEN value1 [value2]
  902.  
  903.     OUTHDG is used to place text headers in your output.  For example, if you
  904.     were parsing data to create an employee report, you might use OUTHDG like
  905.     this:
  906.  
  907.         SET EMPNUM = $FLINE[ 1  5]
  908.         SET NAME   = $FLINE[10 28]
  909.         SET PHONE  = $FLINE[30 45]
  910.         OUTHDG "EMPL#  NAME                PHONE NUMBER"
  911.         OUTHDG "-----  ------------------- ------------"
  912.         OUTEND |{EMPNUM} {NAME} {PHONE}
  913.  
  914.     The value following the OUTHDG command is sent to the output file only
  915.     once.  That is to say, after an OUTHDG sends a value to the output file,
  916.     subsequent encounters with that OUTHDG command are ignored -- unless the
  917.     PAGELEN command is used.
  918.  
  919.     The PAGELEN command specifies the length of the output page.  Lines from
  920.     both OUTHDG and OUTEND are counted.  The default value for page length is
  921.     zero, which means that the output is a single page of infinite length.  As
  922.     such, OUTHDG headings appear only the first time they are encountered.
  923.  
  924.     If you specify a page length greater than zero, OUTHDG headings become
  925.     re-enabled once the specified number of output lines have been generated.
  926.     A typical value is as follows:
  927.  
  928.         PAGELEN "55"
  929.  
  930.     This is an ideal page length for most laser printers.  Dot matrix printers
  931.     typically use a page length of 66.
  932.  
  933.     Parse-O-Matic inserts a "form feed" (ASCII 12) character between pages.
  934.     You can turn this off, however, by specifying the page length this way:
  935.  
  936.         PAGELEN "66" "N"
  937.  
  938.     The "N" specification means, "No, don't use form feeds".  Another
  939.     acceptable value is "Y", meaning "Yes, use form feeds", but since this is
  940.     the default, you do not have to specify it.
  941.  
  942.  
  943.                                  ------------------
  944.                                  The MINLEN Command
  945.                                  ------------------
  946.  
  947.     FORMAT:  MINLEN value1
  948.  
  949.     MINLEN specifies the minimum length a line must be to be considered for
  950.     parsing.  If you omit the MINLEN command, the minimum length is assumed to
  951.     be 1.  That is to say, all lines 1 character or longer will be processed
  952.     and shorter lines (null lines in other words) will be ignored.
  953.  
  954.     MINLEN is useful for ignoring brief information lines that clutter up a
  955.     report that you are parsing.  For example, in the sample file EXAMPL02.POM,
  956.     the MINLEN command is set to 85 to ensure that all lines shorter than 85
  957.     characters long will be ignored.  This simplifies the coding considerably.
  958.  
  959.     The longest allowable input line is 255 characters, unless you use the
  960.     SPLIT or CHOP command (described later).
  961.                               
  962.  
  963.                                  ------------------
  964.                                  The IGNORE Command
  965.                                  ------------------
  966.  
  967.     FORMAT:  IGNORE value1 [comparator] value2
  968.  
  969.     NOTE:    For an explanation of comparators, see the section "Comparators".
  970.              In the following explanation, we will demonstrate the command
  971.              using only the "equals" ("=") comparator.
  972.  
  973.     When value1 contains value2, the input line is ignored and all further
  974.     processing on the input line stops.  The usual format of this command is as
  975.     in this example:
  976.  
  977.         IGNORE $FLINE[3 9] = "Date"
  978.  
  979.     This skips any input line that contains the word "Date" between columns 3
  980.     and 9 ($FLINE is the line just read from the input file).
  981.                               
  982.  
  983.                                  ------------------
  984.                                  The ACCEPT Command
  985.                                  ------------------
  986.  
  987.     FORMAT:  ACCEPT value1 [comparator] value2
  988.  
  989.     NOTE:    For an explanation of comparators, see the section "Comparators".
  990.              In the following explanation, we will demonstrate the command
  991.              using only the "equals" ("=") comparator.
  992.  
  993.     The ACCEPT command accepts the input line if value1 contains value2.  For
  994.     example, if the entire POM file read as follows:
  995.  
  996.         ACCEPT $FLINE[15 17] = "YES"
  997.         OUTEND "X" = "X" |{$FLINE}
  998.  
  999.     then any input line that contains "YES" starting in column 15 is sent to
  1000.     the output file.  All other lines are ignored.
  1001.  
  1002.     CLUSTERED ACCEPTS: Sometimes you have to check more than one value to see
  1003.     if the input line is valid.  You do this by using "clustered ACCEPTs",
  1004.     which are several ACCEPT commands in a row.
  1005.  
  1006.     Briefly stated, if you have several ACCEPTs in a row ("clustered"), they
  1007.     are all processed to determine if the input line is acceptable or not.  If
  1008.     even one ACCEPT matches up, the line is accepted.  To express this in more
  1009.     detail...
  1010.  
  1011.     When value1 contains value2, the line is accepted, and processing of the
  1012.     POM file continues for that input line, even if the immediately following
  1013.     ACCEPTs do NOT produce a match.  After all, we've already got a match!
  1014.  
  1015.     If value1 does NOT contain value2, Parse-O-Matic looks at the next commmand
  1016.     in the POM file.  If it is not another ACCEPT, the input line is ignored.
  1017.     If it is another ACCEPT, maybe it will product a match -- so Parse-O-Matic
  1018.     moves to that command.
  1019.  
  1020.     The following POM file uses clustered ACCEPTs to accept any line that
  1021.     contains the name "FRED" or "MARY" between columns 5 and 8, or contains the
  1022.     word "MEMBER" between columns 20 and 25.
  1023.  
  1024.         SET    NAME = $FLINE[5 8]         (Set the variable)
  1025.         ACCEPT NAME = "FRED"              (Look for FRED)
  1026.         ACCEPT NAME = "MARY"              (Look for MARY)
  1027.         ACCEPT $FLINE[20 25] = "MEMBER"   (Look for MEMBER)
  1028.         OUTEND "X" = "X" |{$FLINE}        (Output the line if we get this far)
  1029.  
  1030.     The following example will NOT work, however:
  1031.  
  1032.         ACCEPT $FLINE[20 25] = "MEMBER"
  1033.         SET    NAME = $FLINE[5 8]
  1034.         ACCEPT NAME = "FRED"
  1035.         ACCEPT NAME = "MARY"
  1036.         OUTEND "X" = "X" |{$FLINE}
  1037.  
  1038.     It will not work because the ACCEPTs are not clustered; if the first ACCEPT
  1039.     fails, the input line is rejected as soon as the SET command is
  1040.     encountered.  The next two ACCEPTs are not reached in such case.
  1041.  
  1042.  
  1043.                                 --------------------
  1044.                                 The READNEXT Command
  1045.                                 --------------------
  1046.  
  1047.     FORMAT:  READNEXT
  1048.  
  1049.     The READNEXT command gets the next line of the input file (in other words,
  1050.     it replaces the current $FLINE), while maintaining your place in the POM
  1051.     file.  This is helpful if you know for certain what the next line will
  1052.     contain.  Here is an example:
  1053.  
  1054.         SET note = ""
  1055.         SET customer = $FLINE[1 20]
  1056.         BEGIN $FLINE ^ "See note below"
  1057.           READNEXT
  1058.           SET note = $FLINE[1 20]
  1059.         END
  1060.         OUTEND |{customer} {note}
  1061.  
  1062.     If the input line contains the words "See note below", Parse-O-Matic will
  1063.     read the next line of the input file (replacing the current $FLINE), thus
  1064.     obtaining the comment about the customer.
  1065.  
  1066.     When you do a READNEXT, there is no way to return to the previous line of
  1067.     the input file.  If you need it for other work, you should save a copy:
  1068.  
  1069.         SET note = ""
  1070.         SET customer = $FLINE[1 20]
  1071.         SET saveline = $FLINE
  1072.         BEGIN $FLINE ^ "See note below"
  1073.           READNEXT
  1074.           SET note = $FLINE[1 20]
  1075.         END
  1076.         SET    custnum = saveline[22 25]
  1077.         OUTEND |{custnum} {customer} {note}
  1078.  
  1079.     The example above is not very efficient; it would make more sense to
  1080.     extract custnum BEFORE you use READNEXT. However, in some instances you may
  1081.     find it more convenient to save $FLINE before doing a READNEXT.
  1082.                                
  1083.  
  1084.                                   ----------------
  1085.                                   The TRIM Command
  1086.                                   ----------------
  1087.  
  1088.     FORMAT:  TRIM var1 spec1 character
  1089.  
  1090.     TRIM removes characters from var1.  This is usually used to remove blanks.
  1091.  
  1092.     spec1 can be:  A=All   B=Both ends   L=Left side only   R = Right side only
  1093.  
  1094.     For example:
  1095.  
  1096.         SET  PRICE = $FLINE[20 26]
  1097.         TRIM PRICE "A" ","
  1098.         TRIM PRICE "L" "$"
  1099.  
  1100.     This removes all commas from the variable "PRICE", and removes the leading
  1101.     dollar sign.  Thus:
  1102.  
  1103.         If the input contains the string:   "$25,783"
  1104.         The first TRIM changes it to:       "$25783"
  1105.         The second TRIM changes it to:      "25783"
  1106.  
  1107.                                   ---------------
  1108.                                   The PAD Command
  1109.                                   ---------------  
  1110.  
  1111.     FORMAT:  PAD var1 spec1 character len
  1112.  
  1113.     PAD makes var1 a specified length, padded with a specified character.
  1114.  
  1115.         spec1      is "L", "R", or "C" (Left, Right or Center)
  1116.         character  is the character used to pad the string
  1117.         len        is the desired string length
  1118.  
  1119.     For example, if the variable ABC is set to "1234" ...
  1120.  
  1121.     PAD ABC "L" "0" "7"   left-pads it 7 characters wide with zeros ("0001234")
  1122.     PAD ABC "R" " " "5"   right-pads it 5 characters wide with spaces ("1234 ")
  1123.     PAD ABC "C" "*" "8"   centers it, 8 wide, with asterisks ("**1234**")
  1124.  
  1125.     If the length is less than the length of the string, it is unchanged.  For
  1126.     example, if you set variable XYZ to "PINNACLE", then
  1127.  
  1128.         PAD XYZ "R" " " "3"
  1129.  
  1130.     leaves the string as-is ("PINNACLE").
  1131.  
  1132.     Thus, PAD can not be used to shorten a string.  If it is your intention to
  1133.     make XYZ 3 letters long, you can use the SET command:
  1134.  
  1135.         SET XYZ = XYZ[1 3]
  1136.  
  1137.  
  1138.                                  ------------------
  1139.                                  The CHANGE Command
  1140.                                  ------------------
  1141.  
  1142.     FORMAT:  CHANGE var1 value1 value2
  1143.  
  1144.     The CHANGE command replaces ALL occurances of value1 with value2.  This is
  1145.     more powerful than TRIM, but is not as efficient.  Here is an example of
  1146.     the CHANGE command in action:
  1147.  
  1148.         SET    DATE = $FLINE[31 38]
  1149.         CHANGE DATE "/" "--"
  1150.  
  1151.     If the SET command assigns DATE the value:    "93/10/15"
  1152.     Then the CHANGE command converts it to:       "93--10--15"
  1153.  
  1154.  
  1155.                                  ------------------
  1156.                                  The PROPER Command
  1157.                                  ------------------
  1158.  
  1159.     FORMAT:  PROPER var1 [methods [exceptions-file]]
  1160.  
  1161.     The PROPER command converts uppercase text (LIKE THIS) to mixed-case text
  1162.     (Like This).  This is useful when you have a list of names of people and
  1163.     addresses.  You can also use PROPER to change text that has been typed
  1164.     in uppercase into normal text, with capital letters at the beginning of
  1165.     sentences.
  1166.  
  1167.     The simplest way to convert a variable is as follows:
  1168.  
  1169.         PROPER CustName
  1170.  
  1171.     If CustName contains "JOHN SMITH", it will be changed to "John Smith".
  1172.  
  1173.     The conversion routine is fairly intelligent.  For example, if it is
  1174.     converting the words "JAGUAR XJS", it can tell that XJS is not a word
  1175.     (since it does not contain any vowels) and so the the end result will
  1176.     be "Jaguar XJS".  Other "strange-looking" items such as serial numbers
  1177.     can often be recognized by the PROPER command, and left untouched.
  1178.  
  1179.     Nevertheless, it is impossible to handle all situations, so the PROPER
  1180.     command supports a "Properization Exceptions File" (known as a PEF file).
  1181.     A PEF file lists unusual combinations of letters (typically abbreviations,
  1182.     such as Dr.).  The Parse-O-Matic package includes a file named GENERIC.PEF,
  1183.     which you may find helpful.  You can view it with the SEE program provided
  1184.     with Parse-O-Matic.
  1185.  
  1186.     A PEF file is prepared with a text editor and contains one "exception" per
  1187.     line.  Null or blank lines, or lines that start with a semicolon, are
  1188.     ignored.  The longest word that can be specified is 255 characters.
  1189.     Spaces are permitted, but leading and trailing spaces and tabs are ignored.
  1190.  
  1191.     To use the PEF file in your PROPER command, place the file name after the
  1192.     variable name and method setting.  For example:
  1193.  
  1194.         PROPER CustName "W" "GENERIC.PEF"
  1195.  
  1196.     The "W" is the method setting (explained later).  "GENERIC.PEF" is the name
  1197.     of the PEF file.  When Parse-O-Matic looks for the PEF file, it looks first
  1198.     in the current directory.  If it can not find it there, it looks in the
  1199.     directory where POM.EXE is located.  You can, if you wish, specify a
  1200.     complete path to the file, as in this example:
  1201.  
  1202.         PROPER Address "W" "C:\MYFILES\MYPEF.XYZ"
  1203.  
  1204.     If you don't need an exceptions file, you should not use it, since it slows
  1205.     down processing somewhat.  Needless to say, the more items you have in the
  1206.     PEF file, the more it slows down processing.
  1207.  
  1208.     The method setting allows you to specify what PROPER does.  There are
  1209.     several kinds of controls, as follows:
  1210.  
  1211.     METHOD   DESCRIPTION
  1212.     ------   -----------
  1213.       I      Intelligent determination of non-words
  1214.       S      Upcase the first character of each sentence
  1215.       U      Upcase the first alphanumeric character of the line
  1216.       W      Upcase the first letter of each word
  1217.  
  1218.     The default method setting is "IW", so if you omit the method setting, or
  1219.     specify a null setting (e.g. PROPER CustName "" "XYZ.PEF"), PROPER will
  1220.     upcase non-words, and the first letter of each word.
  1221.  
  1222.     NOTE:  If you specify a PEF file, you must also specify a method setting,
  1223.     even if it is null.  The line PROPER "GENERIC.PEF" would not be understood
  1224.     by Parse-O-Matic.  The correct format would be:  PROPER "" "GENERIC.PEF"
  1225.  
  1226.     The examples provided with Parse-O-Matic demonstrate some ways you can use
  1227.     the PROPER command.  To see the examples, enter START at the DOS prompt,
  1228.     then select EXAMPLES.
  1229.  
  1230.  
  1231.                                  ------------------
  1232.                                  The INSERT Command
  1233.                                  ------------------
  1234.  
  1235.     FORMAT:  INSERT var1 spec1 value1
  1236.  
  1237.     The INSERT command inserts text on the left or right of var1, or at a
  1238.     "found text" position.
  1239.  
  1240.         spec1  is "L" or "R" (Left or Right) or a find-string (e.g.  "@HELLO")
  1241.         value1 is the value to be inserted
  1242.  
  1243.     For example, if the variable ABC is set to "Parse-O-Matic", then
  1244.  
  1245.         INSERT ABC "L" "Register "    sets ABC to "Register Parse-O-Matic"
  1246.         INSERT ABC "R" " is super"    sets set ABC to "Parse-O-Matic is super"
  1247.  
  1248.     You can use a find-string to insert text at the first occurance of the text
  1249.     you specify.  For example:
  1250.  
  1251.         INSERT ABC "@-O-Matic" "!"    sets ABC to "Parse!-O-Matic"
  1252.  
  1253.     If the find-string is not found, nothing is done.
  1254.  
  1255.     For an alternative to INSERT, see the APPEND command.
  1256.  
  1257.  
  1258.                                  ------------------
  1259.                                  The APPEND Command
  1260.                                  ------------------
  1261.  
  1262.     FORMAT:  APPEND var1 value1 value2 [value3 [value4]]
  1263.  
  1264.     The APPEND command concatenates (adds together) two or more values and
  1265.     places the result in var1.  For example:
  1266.  
  1267.         APPEND xyz "AB" "CD" "EF" "GHIJ"
  1268.  
  1269.     This command sets the variable xyz to "ABCDEFGHIJ".
  1270.  
  1271.     The third and fourth values (value3 and value4 in the FORMAT shown above)
  1272.     are optional.  Thus, you can use APPEND with only two values.  For example:
  1273.  
  1274.         SET    x1 = "AB"
  1275.         SET    x2 = "CD"
  1276.         APPEND x3 x1 x2
  1277.  
  1278.     This sets the variable x3 to "ABCD".  You can concatenate a maximum of four
  1279.     values with a single APPEND command.  If you require additional concaten-
  1280.     ations, you can use more APPEND commands:
  1281.  
  1282.         APPEND myvar "ABC" "DEF" "GHI" "JKL"
  1283.         APPEND myvar myvar "MNO" "PQR"
  1284.  
  1285.     The first line sets the variable myvar to "ABCDEFGHIJKL".  The second line
  1286.     set myvar to its previous value, plus "MNOPQR", so that its final value is
  1287.     "ABCDEFGHIJKLMNOPQR".
  1288.  
  1289.     NOTE:  No variable can hold more than 255 characters.
  1290.  
  1291.  
  1292.                                  -----------------
  1293.                                  The SPLIT Command
  1294.                                  -----------------
  1295.  
  1296.     FORMAT:  SPLIT from-position to-position [,from-pos'n to-pos'n] [...]
  1297.  
  1298.     The maximum length of an input line from a text file is 255 characters.  If
  1299.     your input file is wider than that, you must break up the file into
  1300.     manageable chunks, using the SPLIT command.  This command lets you specify
  1301.     the way in which each input line is broken up so that it will look like
  1302.     several SEPARATE lines.
  1303.  
  1304.     For example, if your input lines were up to 300 characters wide, you could
  1305.     specify:
  1306.  
  1307.         SPLIT 1 255, 256 300
  1308.  
  1309.     This breaks up each line as if it was two lines.  (If some of the lines are
  1310.     less than 256 characters, they will still be treated as two lines, although
  1311.     the second line will be null (i.e. empty).)
  1312.  
  1313.     You can specify up to 100 splits (use multiple SPLIT commands if
  1314.     necessary).  With SPLIT, Parse-O-Matic can handle input records of up to
  1315.     32767 characters.
  1316.  
  1317.     The best way of handling SPLIT or CHOPped files is to use a combination of
  1318.     $SPLIT (explained in more detail later) and BEGIN/END.  For example:
  1319.  
  1320.         SPLIT 1 250, 251 300
  1321.         BEGIN $SPLIT = "1"
  1322.           SET a = $FLINE[ 1 10]
  1323.           SET b = $FLINE[11 20]
  1324.         END
  1325.         BEGIN $SPLIT = "2"
  1326.           SET x = $FLINE[ 1 10]
  1327.           SET y = $FLINE[11 20]
  1328.           OUTEND |{a} {b} {x} {y}
  1329.         END
  1330.  
  1331.     This outputs the data which appears (in the input file) in columns 1-10,
  1332.     11-20, 251-260 and 261-280.
  1333.  
  1334.  
  1335.                                   ----------------
  1336.                                   The CHOP Command
  1337.                                   ----------------
  1338.  
  1339.     FORMAT:  CHOP from-position to-position [,from-pos'n to-pos'n] [...]
  1340.  
  1341.     The CHOP command works the same way as the SPLIT command, with one
  1342.     exception:  it informs Parse-O-Matic that the input is a fixed-record-
  1343.     length file. In other words, it means that the input records are
  1344.     distinguished by having a particular (and exact) length, rather than being
  1345.     separated by end-of-line characters (Carriage Return, Linefeed) as is the
  1346.     case for a standard text file.
  1347.  
  1348.     Thus, if you have an input file containing fixed-length records, each of
  1349.     which is 200 characters wide, you could specify it like this:
  1350.  
  1351.         CHOP 1 200
  1352.  
  1353.     If the input record is more than 255 characters, you must break it up into
  1354.     smaller chunks.  For example, if the input record was 300 characters wide,
  1355.     you could break it up like this:
  1356.  
  1357.         CHOP 1 250, 251 300
  1358.  
  1359.     By using CHOP, Parse-O-Matic can handle input records up to 32767
  1360.     characters wide.  You can use the $SPLIT variable to manage your use of
  1361.     CHOP.  See the example in the section describing the SPLIT command.
  1362.                               
  1363.  
  1364.                                  ------------------
  1365.                                  The LOOKUP Command
  1366.                                  ------------------
  1367.  
  1368.     FORMAT:  LOOKUP var1 value1
  1369.  
  1370.     The LOOKUP command will search for value1 in a text file (the name of which
  1371.     is specified either by the LOOKFILE command or the /L startup parameter).
  1372.     When POM finds it, it sets var1 to another value found on the same line.
  1373.  
  1374.     Let us suppose you created a text file, named NAMES.TBL, like this:
  1375.                     
  1376.         R. REAGAN        Ronald Reagan
  1377.         D. EISENHOWER    Dwight Eisenhower
  1378.         G. BUSH          George Bush
  1379.         :                :
  1380.         Column 1         Column 18
  1381.  
  1382.     This file can be used to look up a name, as in this POM file:
  1383.  
  1384.         LOOKFILE "NAMES.TBL"
  1385.         LOOKCOLS "1" "17" "18" "34"
  1386.         SET      oldname = $FLINE[21 37]
  1387.         TRIM     oldname "R" " "
  1388.         LOOKUP   newname = oldname
  1389.         OUTEND   |{oldname} {newname}
  1390.  
  1391.     The LOOKFILE command specifies the name of the look-up file.  The LOOKCOLS
  1392.     command specifies the starting and end columns for both the "text-to-look-
  1393.     for" field (known as the key field) and the "text-to-replace-with" field
  1394.     (known as the data field).
  1395.  
  1396.     The LOOKUP command will look for oldname in NAMES.TBL.  If oldname is set
  1397.     to "G. BUSH", LOOKUP sets newname to "George Bush".  If, however, oldname
  1398.     is set to "G. WASHINGTON", which doesn't appear in NAMES.TBL, newname
  1399.     is set to "" (that is to say, an empty string).
  1400.  
  1401.     There is no limit to the number of lines that you can put in a look-up
  1402.     file.  However, the more lines there are, the longer it will take to
  1403.     process (because there is more to search).  The maximum length of a line
  1404.     in a look-up file is 255 characters.
  1405.  
  1406.     In the look-up file, null (empty) lines are ignored.  You can also include
  1407.     comments in the file by starting the line with a semi-colon:
  1408.  
  1409.         ; Some of the Presidents of the United States
  1410.         R. REAGAN        Ronald Reagan
  1411.         D. EISENHOWER    Dwight Eisenhower
  1412.         G. BUSH          George Bush
  1413.  
  1414.     The LOOKUP command can be used for more than just names, of course.  You
  1415.     could use it to look up prices, phone numbers, addresses and so on.
  1416.  
  1417.  
  1418.                                 --------------------
  1419.                                 The LOOKFILE Command
  1420.                                 --------------------
  1421.  
  1422.     FORMAT:  LOOKFILE value1
  1423.  
  1424.     The LOOKFILE command specifies the name of the look-up file for the next
  1425.     LOOKUP command.  This lets you use several look-up files in one POM file.
  1426.     For example:
  1427.  
  1428.         SET name = $FLINE[1 20]
  1429.         ; Look up full name
  1430.         LOOKFILE "NAMES.TBL"
  1431.         LOOKCOLS "1" "25" "30" "50"
  1432.         LOOKUP   fullname = name
  1433.         ; Look up phone number
  1434.         LOOKFILE "PHONE.TBL"
  1435.         LOOKCOLS "1" "25" "30" "40"
  1436.         LOOKUP   phone = name
  1437.         ; Output result
  1438.         OUTEND   |{name} {fullname} {newname}
  1439.  
  1440.     If you only have one look-up file, you may omit the LOOKFILE command and
  1441.     specify the file name on the command line, using the /L parameter.  For
  1442.     example, you could write a POM file like this:
  1443.  
  1444.         SET name = $FLINE[1 20]
  1445.         ; Look up full name
  1446.         LOOKCOLS "1" "25" "30" "50"
  1447.         LOOKUP   fullname = name
  1448.         ; Output result
  1449.         OUTEND   |{name} {fullname}
  1450.  
  1451.     Your POM command could then look like this:
  1452.  
  1453.         POM MYPOM.POM INPUT.TXT OUTPUT.TXT /LC:\MYFILES\NAMES.TBL
  1454.  
  1455.     This technique allows you to use several different look-up files with the
  1456.     same POM file, simply by changing the command line.
  1457.                              
  1458.  
  1459.                                 --------------------
  1460.                                 The LOOKCOLS Command
  1461.                                 --------------------
  1462.  
  1463.     FORMAT:  LOOKCOLS value1 value2 value3 value4
  1464.  
  1465.     The LOOKCOLS command specifies the starting and ending columns for the
  1466.     key and data fields in a look-up file (see the explanation of the LOOKUP
  1467.     command for an overview of look-up files).
  1468.  
  1469.         value1 specifies the starting column for the key  field
  1470.         value2 specified the  ending  column for the key  field
  1471.         value3 specifies the starting column for the data field
  1472.         value4 specified the  ending  column for the data field
  1473.  
  1474.     You can specify a null value to indicate "same as last time".  For example:
  1475.  
  1476.         SET name = $FLINE[1 20]
  1477.         LOOKFILE "NAMES.TBL"
  1478.         LOOKCOLS "1" "25" "30" "50"
  1479.         LOOKUP   fullname = name
  1480.         LOOKFILE "PHONE.TBL"
  1481.         LOOKCOLS "" "" "" "40"
  1482.         LOOKUP   phonenum = name
  1483.         OUTEND   |{name} {fullname} {phonenum}
  1484.  
  1485.     The second LOOKCOLS command uses the same numbers for the first three
  1486.     values that the first LOOKCOLS command used.
  1487.  
  1488.     If you do not specify a LOOKCOLS command, the default values are:
  1489.  
  1490.        Key Field:   Starting column  =   1
  1491.                     Ending column    =  10
  1492.        Data Field:  Starting column  =  12
  1493.                     Ending column    = 255
  1494.  
  1495.     This is equivalent to LOOKCOLS "1" "10" "12" "255".
  1496.  
  1497.  
  1498.                                 --------------------
  1499.                                 The LOOKSPEC Command
  1500.                                 --------------------
  1501.  
  1502.     FORMAT:  LOOKSPEC value1 value2 value3
  1503.  
  1504.     The LOOKSPEC command configures the way the next LOOKUP command will work.
  1505.                                                 
  1506.         value1 = Trim             ("Y" or "N" -- default "Y")
  1507.         value2 = Sorted           ("Y" or "N" -- default "N")
  1508.         value3 = Case-sensitive   ("Y" or "N" -- default "N")
  1509.  
  1510.     The Trim setting specifies whether or not the data field should have spaces
  1511.     stripped off both ends.
  1512.  
  1513.     The Sorted setting specifies whether or not the look-up file is sorted by
  1514.     the key field.  A sorted file is much faster than an unsorted file.  This
  1515.     is especially noticeable if you have a large look-up file and a lot of
  1516.     input to process.
  1517.  
  1518.     The Case-sensitive setting specifies whether or not LOOKUP should distin-
  1519.     guish between upper and lower case when searching.  The default setting is
  1520.     "N" (No), so that LOOKUP would find "John Smith", even if it appeared in
  1521.     the look-up file as "JOHN SMITH".  It is usually safest to set Case-
  1522.     sensitivity to "N", but if you set it to "Y", searching is slightly faster.
  1523.  
  1524.     You can specify a null value to indicate "same as last time".  For example:
  1525.  
  1526.         SET name = $FLINE[1 20]
  1527.         LOOKFILE "DATA.TBL"
  1528.         LOOKCOLS "1" "25" "30" "50"
  1529.         LOOKSPEC "Y" "Y" "Y"
  1530.         LOOKUP   fullname = name
  1531.         LOOKCOLS "" "" "60" "70"
  1532.         LOOKSPEC "N" "" ""
  1533.         LOOKUP   phonenum = name
  1534.         OUTEND   |{name} {fullname} {phonenum}
  1535.  
  1536.     The second LOOKSPEC command uses the same settings for Sorted and Case-
  1537.     sensitivity as the first one, but specifies a different Trim setting.
  1538.  
  1539.  
  1540.                                  -----------------
  1541.                                  The TRACE Command
  1542.                                  -----------------
  1543.  
  1544.     FORMAT:  TRACE var1
  1545.  
  1546.     The TRACE command is an alternative to standard tracing (see "Tracing", in
  1547.     the "Terms and Techniques" section).
  1548.  
  1549.     When you include a TRACE command in your POM file, Parse-O-Matic will
  1550.     create a text file, named POM.TRC, and use it to keep a detailed record of
  1551.     POM's processing.  Here is an example of the TRACE command:
  1552.  
  1553.     TRACE PRICE
  1554.  
  1555.     This traces the variable named "PRICE".  After processing, the file POM.TRC
  1556.     will show everything that happened, and give the value of PRICE at the
  1557.     TRACE line.
  1558.  
  1559.     NOTE:  Since trace files are so detailed, they can be very large.  If you
  1560.     are trying to debug a POM file using TRACE, it is a good idea to use a
  1561.     small input file.
  1562.  
  1563.  
  1564.                                  ------------------
  1565.                                  The SETLEN Command
  1566.                                  ------------------
  1567.  
  1568.     FORMAT:  SETLEN var1 value1
  1569.  
  1570.     SETLEN sets var1 to the length of value1.  For example:
  1571.  
  1572.         SET    x = "ABCD"
  1573.         SETLEN y x
  1574.  
  1575.     This sets variable y to "4".
  1576.  
  1577.     One handy application for SETLEN is to underline text.  For example:
  1578.  
  1579.         SET     name = $FLINE[1 15]
  1580.         TRIM    name "B" " "
  1581.         SETLEN  nlen name
  1582.         SET     uline = ""
  1583.         PAD     uline "L" "-" nlen
  1584.         OUTEND  |{name}
  1585.         OUTEND  |{uline}
  1586.  
  1587.     If the input line contains the name "JOHN SMITH", the output would be:
  1588.  
  1589.         JOHN SMITH
  1590.         ----------
  1591.  
  1592.  
  1593.  
  1594.     ===========================================================================
  1595.                                 TERMS AND TECHNIQUES
  1596.     ===========================================================================
  1597.  
  1598.  
  1599.                                        ------
  1600.                                        Values
  1601.                                        ------
  1602.  
  1603.     A value can be specified in the following ways:
  1604.  
  1605.         "text"              A literal text string
  1606.         #number             A single ASCII character (e.g. #32 = Space)
  1607.         #number#number...   Several ASCII characters (e.g. #32#32 = 2 Spaces)
  1608.         VARNAME             The name of a variable
  1609.         VARNAME[start end]  A substring of a variable
  1610.         VARNAME[start]      A single character
  1611.         VARNAME+            Incremented variable (see explanation below)
  1612.  
  1613.     Variable names can be up to 8 characters long.  There is no distinction
  1614.     between upper and lower case in the variable name.  A POM file can contain
  1615.     about 1000 variables and literals.
  1616.  
  1617.     The # character is used to specify a literal text string of one or more
  1618.     characters.  Follow each # with the decimal value of the ASCII character
  1619.     you want.  Here are some useful values:
  1620.  
  1621.         #10 = Line Feed   #12 = Form Feed   #13 = Carriage Return
  1622.  
  1623.     Parse-O-Matic predefines several variables.  They are:
  1624.  
  1625.         $FLINE = The line just read from the file (max. length 255 characters)
  1626.         $FLUPC = The line just read from the file, in uppercase
  1627.         $BRL   = The { character (used in OUT)
  1628.         $BRR   = The } character (used in OUT)
  1629.         $TAB   = The tab character (Hex $09; ASCII 09)
  1630.         $SPLIT = The CHOP or SPLIT number you are currently processing
  1631.  
  1632.     Since $FLINE has a maximum length of 255 characters, you will have to use
  1633.     the SPLIT or CHOP command if your input file is wider than that.  The
  1634.     $SPLIT variable reports which segment you are processing.  For example,
  1635.     if you had this command...
  1636.  
  1637.         CHOP 1 255, 256 380
  1638.  
  1639.     then $SPLIT would be set to "1" when it was processing columns 1 to 255,
  1640.     and it would be set to "2" when it was processing columns 256 to 380.
  1641.  
  1642.  
  1643.                                      ----------
  1644.                                      Delimiters
  1645.                                      ----------
  1646.  
  1647.     If you need to specify a quotation mark, use "".  For example:
  1648.  
  1649.         IGNORE $FLINE = "He said ""Hello"" to me."
  1650.  
  1651.     This ignores any line containing:  He said "Hello" to me.
  1652.  
  1653.  
  1654.                                  ------------------
  1655.                                  Illegal Characters
  1656.                                  ------------------
  1657.  
  1658.     No command can contain these ASCII characters:
  1659.  
  1660.         HEX   DECIMAL   NAME
  1661.         ---   -------   --------------------
  1662.         $00      0      NULL
  1663.         $0A     10      LF (Linefeed)
  1664.         $0D     13      CR (Carriage Return)
  1665.  
  1666.     Of course, LF and CR do appear at the end of each line, in a text file.
  1667.  
  1668.  
  1669.                                     -----------
  1670.                                     Comparators
  1671.                                     -----------
  1672.  
  1673.     The ACCEPT, BEGIN, IF, IGNORE, OUT and OUTEND commands each decide what to
  1674.     do by comparing two values.  For example:
  1675.  
  1676.         IF $FLINE[1 3] = "XYZ" THEN x = "3" ELSE "4"
  1677.  
  1678.     In this example, if the first three characters of $FLINE are "XYZ", the
  1679.     variable x is set to "3", otherwise it is set to "4".  The first equals
  1680.     sign ("=") is a "comparator", because it defines how two values will be
  1681.     compared.  The second equals sign is not a comparator; it is simply
  1682.     padding, which makes the line easier to understand (see the section
  1683.     "Padding for Clarity" for details).
  1684.  
  1685.     Parse-O-Matic allows the following comparators:
  1686.  
  1687.     COMPARATOR MEANING            EXAMPLE
  1688.     ---------- ------------------ ---------------------------------------------
  1689.     <>         Does not equal     IF name <> "Fred" THEN z = "This is not Fred"
  1690.     =          Equals             IF numeral = "IV" THEN x = "4"
  1691.     >          More than          IF x >  "4" THEN z = "x is more than four"
  1692.     >=         More than or equal IF x >= "4" THEN z = "x is four or more"
  1693.     <          Less than          IF x <  "4" THEN z = "x is less than four"
  1694.     <=         Less then or equal IF x <= "4" THEN z = "x is four or less"
  1695.     ^          Contains           IF x ^  "4" THEN z = "x contains a four"
  1696.     ~          Does not contain   IF X ~  "4" THEN z = "x doesn't contain four"
  1697.     LONGER     Length is longer   IF x LONGER  y THEN z = "x is longer than y"
  1698.     SHORTER    Length is shorter  IF x SHORTER y THEN z = "x is shorter than y"
  1699.     SAMELEN    Length is the same IF x SAMELEN y THEN z = "Same length as y"
  1700.  
  1701.     Whenever a comparator is required, but is omitted, it is assumed to be
  1702.     "equals".  Thus, the following lines are equivalent:
  1703.  
  1704.         IF x y z "3" "4"                   (This is very terse, but it works)
  1705.         IF x   y THEN z = "3" ELSE "4"     (The "equals" comparator is omitted)
  1706.         IF x = y THEN z = "3" ELSE "4"     (This is a lot easier to read)
  1707.  
  1708.     Comparators work on numeric and alphabetic data.  Here are some samples:
  1709.  
  1710.                    "ABC" <>      "ABCD"      "3" <>      "4"
  1711.                    "ABC" <=      "ABCD"      "3" <=      "4"
  1712.                    "ABC" <       "ABCD"      "3" <       "4"
  1713.                    "ABC" SHORTER "ABCD"      "3" SAMELEN "4"
  1714.  
  1715.                    "ABC" >=      "ABC"       "ABC" <>      "CDE"
  1716.                    "ABC" <=      "ABC"       "ABC" <=      "CDE"
  1717.                    "ABC" =       "ABC"       "ABC" <       "CDE"
  1718.                    "ABC" ^       "ABC"       "ABC" SAMELEN "CDE"
  1719.                    "ABC" SAMELEN "ABC"
  1720.  
  1721.     IF YOU USED PARSE-O-MATIC PRIOR TO VERSION 3.00:  Because the comparator
  1722.     defaults to "equals" if it is omitted, POM files created before version
  1723.     3.00 will continue to function normally -- with two notable exceptions.
  1724.     In older versions, the IGNORE and ACCEPT commands defaulted to "contains".
  1725.     If you have POM files that were created for older versions, you should
  1726.     check your IGNORE and ACCEPT commands to ensure that they are doing what
  1727.     you want them to.
  1728.  
  1729.  
  1730.                                     ------------
  1731.                                     Incrementing
  1732.                                     ------------
  1733.  
  1734.     You can add "1" to a variable in a SET statement.  For example:
  1735.  
  1736.     SET x = "3"
  1737.     SET x = x+
  1738.  
  1739.     After the second statement, x would have the value "4".
  1740.  
  1741.     Only numeric incrementing is supported.  Attempting to increment another
  1742.     type of variable will result in an error.
  1743.  
  1744.     - Incrementing "1" gives you "2"
  1745.     - Incrementing "9" gives you "10"
  1746.  
  1747.     The first time a variable is referenced, it has a null value (unless you
  1748.     SET it yourself).  If you increment a null variable, it will be changed
  1749.     from "" (i.e. null) to "1".
  1750.  
  1751.  
  1752.                                    -------------
  1753.                                    Line Counters
  1754.                                    -------------
  1755.  
  1756.     If your input record is divided over several lines (due to its original
  1757.     format or perhaps because you used the SPLIT or CHOP command), it is
  1758.     helpful to set up a line counter.  The following example extracts the first
  1759.     six characters of the second line of input records that span three lines
  1760.     (designated lines 0, 1 & 2):
  1761.  
  1762.         IF     LineCntr = "1" THEN MyField = $FLINE[1 6]
  1763.         OUTEND LineCntr = "1" |{MyField}
  1764.         IF     LineCntr = "2" THEN LineCntr = "" ELSE LineCntr+
  1765.  
  1766.     For an alternative to line counters, see "The READNEXT Command".
  1767.  
  1768.  
  1769.                                       -------
  1770.                                       Tracing
  1771.                                       -------
  1772.  
  1773.     By setting the DOS variable POM to ALL, you can generate a trace file,
  1774.     named POM.TRC.  This is helpful if you have trouble understanding why your
  1775.     file isn't being parsed properly.  But be sure to test it with a SMALL
  1776.     input file; the trace is quite detailed, and it can easily generate a huge
  1777.     output file.
  1778.  
  1779.     To save space, you can specify a particular list of variables to be traced,
  1780.     rather than tracing everything.  For example, to trace only the variable
  1781.     PRICE, enter this DOS command:
  1782.  
  1783.         SET POM=PRICE
  1784.  
  1785.     To trace several variables, separate the variable names by slashes, as in
  1786.     this example:
  1787.  
  1788.         SET POM=PRICE/BONUS/NAME
  1789.  
  1790.     This traces the three variables PRICE, BONUS and NAME.
  1791.  
  1792.  
  1793.                                      ----------
  1794.                                      Quiet Mode
  1795.                                      ----------
  1796.  
  1797.     Sometimes you don't want the user to see the Parse-O-Matic processing
  1798.     screen.  In such cases, you can use the "Quiet Mode" switch (/Q) on the
  1799.     command line.  For example:
  1800.  
  1801.         POM XYZ.POM MYFILE.TXT TEMP.TXT /Q
  1802.  
  1803.     The /Q switch suppresses the display of the processing screen.  The only
  1804.     time a user will see anything is if there is a problem (for example:  the
  1805.     input file was not found).    
  1806.  
  1807.                                      ---------
  1808.                                      DbF Files
  1809.                                      ---------
  1810.  
  1811.     If Parse-O-Matic notices that the input file is a "DBase" file (i.e. it has
  1812.     a DBF extension -- for example:  MYFILE.DBF), it will change the way it
  1813.     processes the data.  For instance, the variable $FLINE is not defined.
  1814.     Rather, each of the fields in the database are pre-parsed.  Thus, if you
  1815.     have a DBF file containing three fields (EMPNUM, NAME, PHONE), your entire
  1816.     POM file might look like this:
  1817.  
  1818.         IGNORE DELETED "Y"
  1819.         OUTEND |{EMPNUM} {NAME} {PHONE}
  1820.  
  1821.     The DELETED variable is created automatically for each record.  If it is
  1822.     set to "Y", it means the record has been deleted from the database and is
  1823.     probably not valid.  In most cases, you will want to ignore such records.
  1824.  
  1825.     If you do not know what the field names are, you can obtain the list with
  1826.     the following POM file:
  1827.  
  1828.         TRACE DELETED
  1829.  
  1830.     Afterwards, when you inspect the trace file (POM.TRC), you will see a
  1831.     summary of all the fields.  Since there are no output commands (e.g. OUTEND
  1832.     and OUTHDG), the output file will be empty.
  1833.  
  1834.     NOTE:  Parse-O-Matic does not currently support DBF "Memo" fields.
  1835.  
  1836.                           --------------------------------
  1837.                           Converting Comma-Delimited Files
  1838.                           --------------------------------
  1839.  
  1840.     As explained in the section "The PARSE Command", Parse-O-Matic can convert
  1841.     comma-delimited files to columnar format.  However, if you are frequently
  1842.     faced with this task, you may find it easier to use Pinnacle Software's
  1843.     CCDF utility.  When you register Parse-O-Matic, we will send you an
  1844.     evaluation copy of CCDF.  If you are in a hurry, you can download a copy
  1845.     from our free files BBS at 514-345-8654.  (Sign on as GUEST -- no password
  1846.     needed -- and enter the command GET CCDF to start downloading the file
  1847.     CCDF.ZIP.  The default download protocol is ZMODEM, but you can change this
  1848.     with the PROTOCOL command.)
  1849.  
  1850.                                       --------
  1851.                                       Examples
  1852.                                       --------
  1853.  
  1854.     Most of the techniques described in this manual are demonstrated by the
  1855.     examples provided with the standard Parse-O-Matic package.  To see these
  1856.     examples, switch to your Parse-O-Matic directory and type START at the DOS
  1857.     prompt.
  1858.  
  1859.  
  1860.  
  1861.     ===========================================================================
  1862.                                      LICENSING
  1863.     ===========================================================================
  1864.  
  1865.     This product is available in several versions:
  1866.  
  1867.     SHAREWARE:  Shareware means that you are entitled to evaluate this program
  1868.     at no cost for a reasonable period (about 45 days).  If you continue to use
  1869.     it after that, you are required to purchase a registered copy (see below).
  1870.  
  1871.     REGISTERED:  When you register a shareware copy of this product, you will
  1872.     receive the latest version, plus an unlocking code that will let you
  1873.     register any new shareware versions that we release for a period of two
  1874.     years. The file OPTIONS.DOC explains the various payment methods available.
  1875.     A registered copy provides you with a single-user license.
  1876.  
  1877.     SITE/MULTI-COPY LICENSES:  If you plan to run 15 or more copies of this
  1878.     program simultaneously (on a network or on separate computers), you can
  1879.     obtain quantity pricing.  See the order form (file ORDER.FRM) for details.
  1880.  
  1881.     DISTRIBUTION LICENSE:  The distribution license ($750) allows you to use an
  1882.     unlimited number of copies of a specially personalized copy.  You may
  1883.     include it in a commercial package as a utility.  The only restriction is
  1884.     that you may not distribute this document (i.e. the user manual) or its
  1885.     essential content.  With this safeguard, we avoid placing ourselves in
  1886.     competition with you; the program must be used to support a product rather
  1887.     than being a main selling feature.
  1888.  
  1889.     RETAIL LICENSE:  You can sell complete, registered copies of this product,
  1890.     complete with documentation, in return for royalties.  The terms depend on
  1891.     volume and advance payments. The license is $100 plus the following royalty
  1892.     scale:
  1893.                                  
  1894.     Non-exclusive, prepayment for  1,000 copies ------------------- $1.00/copy
  1895.     Non-exclusive, prepayment for  5,000 copies ------------------- $0.50/copy
  1896.     Non-exclusive, prepayment for 10,000 copies ------------------- $0.30/copy
  1897.     Non-exclusive, prepayment for 25,000 copies ------------------- $0.20/copy
  1898.     Non-English exclusive, 10,000 copy prepayment ----------------- $0.35/copy
  1899.     Non-English exclusive, 25,000 copy prepayment ----------------- $0.25/copy
  1900.  
  1901.     In the above rate schedule, packaging, product duplication and support are
  1902.     the responsibility of the retailer.  For non-English versions, we have a
  1903.     team available which can handle language conversions (this service is
  1904.     priced separately).  If you wish to obtain a retail license, please contact
  1905.     us to request the retail license contract appropriate to your requirements.
  1906.  
  1907.  
  1908.