Equals (Set Variable)
 
Format #1 v1 =v2 [v3 v4 v5...]  
Examples MyVar1 ='Hello'
MyVar2 =MyVar
MyVar4 =OtherVar [10 20 ]
MyVar5 ='How ''are ''you?'
;Set var to a literal
;Set one var to another
;Columns 10 to 20
;Append three literals
Purpose Sets v1 to v2 (and any other values listed thereafter)
Parameters v1 -Variable being set
v2 -Value
v3 -Value (any number of values can be appended)
Format #2 v1 =f2  
Example MyVar6 =Cols xyz 5 8 ;Set var from a function
Purpose Sets v1 from a function  
Parameters v1 -Variable being set
f2 -Function (with any parameters it may use)

A “function ” is a command that returns a value.The Cols command is an example of a function,while the
OutEnd command is not a function because it does not return a value.
 
Len
 
Format v1 =Len v2 [v3 v4 v5...]
Examples MyVar1 =Len MyVar2 ;If MyVar2 is 'ABC',MyVar1 will be '3'
MyVar =Len X1 X2 ;Measure total length of appended values
Purpose Sets v1 to the length (number of characters)in v2
Parameters v1 -Variable being set
v2 -Value being measured
v3 -Value (any number of values can be appended)
 
ParseName
 
Format ParseName v1 v2 v3 v4 v5 v6 v7
Examples ParseName 'John Smith''No'addform first middle last suffix
Purpose Breaks up a name into its component parts
Parameters v1 -The unparsed name
v2 -Control setting:detect company names?
v3 -Variable to receive address form (e.g.'Mister')
v4 -Variable to receive first name (e.g.'John')
v5 -Variable to receive middle name (e.g.'J.')
v6 -Variable to receive last name (e.g.'Smith')
v7 -Variable to receive suffix (e.g.'the third')
Controls v2 =Yes/No

ParseName provides some basic capability for breaking up a proper name.The results cannot be completely accurate because there are so many possible variations.Thus,if you use ParseName (typically to create a CSV record),you should review the results afterwards and modify your script to handle exceptions.

In addition,you should not assume that ParseName will return the same results when using different versions of Parse-O-Matic.The ParseName command is occasionally updated to improve its “intelligence ” . ParseName is a handy time-saver,but there are no definitive rules for this kind of operation.

If the control setting (v2)is set to 'Yes',ParseName can detect many company names,placing the entire value in v4.This,too,is not entirely reliable.For example,'John Jones Enterprises'will be recognized as a company,but 'Les Entreprises John Jones'(i.e.the company name in French)is not.

Despite its limitations,ParseName is a helpful command:it can greatly reduce the effort required if you are converting a large list of names.
 
Plural
 
Format v1 =Plural v2 v3 [v4 ]
Examples Word =Plural 'cat'NumBeasts ;If NumBeasts =3 returns 'cats'
Purpose Provisionally adds the letter 's'to a word if it is appropriate
Parameters v1 -Variable being set
v2 -The word being counted,which might have an 's'added
v3 -The number of v2 items being considered
v4 -Control setting (Preserve length?Yes/No)
Controls If v4 ='Yes',we append a space to v1 if the 's'is omitted.
This maintains the alignment of columnar output.
Defaults v4 ='No'
This simple command makes it easy to avoid unattractive “tentative plurals ” such as “item(s)”.For example:

Items =Plural 'item'ItemCount
OutEnd 'We have 'ItemCount 'Items 'in stock'

If ItemCount is 1,the output reads 'We have 1 item in stock'.For any other number,an 's'is added.For
example:'We have 3 items in stock'.If ItemCount is a real number — even 1.0 — an ''s'is added,since that
is the way it would normally be spoken in context (e.g.“The score is one point zero points")
 
SetFromFile
 
Format v1 =SetFromFile v2 [v3 ]
Examples MyVar1 =SetFromFile 'MyFile.txt'
MyVar2 =SetFromFile 'C:\Stock \Greeting.txt'
Purpose Reads data from a file into a variable
Parameters v1 -Variable being set
v2 -File name
v3 -Control settings
Controls 'Text'=The file is a text file (may end with Ctrl-Z)
'Binary'=The file is a binary file
Defaults v3 ='Text'
Similar Cmds LookUp
 
If v3 is not specified,the file is considered to be text,and any end-of-line (CRLF)characters are stripped
from the start and end of v1.

SetFromFile sets the $Success variable to 'Y'if the file was successfully read,'N'otherwise.

If the filename (v2)does not specify a path,SetFromFile will use the Search Path to look for it.

In theory,SetFromFile can read in a file that is several billion characters long.In practice,however,the size
of the file you can read in is limited by your computer ’ s memory.
 
SplitCSV
 
Format v1 =SplitCSV v2 [v3 [v4 ]]
Examples ParsedCSV =SplitCSV FileData
Purpose Converts data in CSV (Comma Separated Value)format into a
format that is much easier to take apart with the Parse
command (using 'Cut Relaxed',for example)
Parameters v1 -Variable being set
v2 -The CSV data
v3 -The string with which to replace the old delimiter
v4 -The old delimiter (usually a comma or a semicolon)
Defaults v3 =Carriage-return character (ASCII #13)
v4 =The comma character
Similar Cmds Parse
   
SplitCSV parses a line of comma-delimited text,replacing the commas with the new delimiter (v3).Any
double-quotes (")around fields are removed,while doubled-up quotes ("")are replaced with single “ quotes.
For example:

MyVar ='"Mary ""The Parser""Jones";123.45;"416-555-1212"'
ParsedCSV =SplitCSV A '/'';'


This would set the ParsedCSV variable to the following value:
Mary "The Parser"Jones /123.45 /416-555-1212
When processing CSV data,bear in mind that in some countries the standard delimiter is the semicolon (;)
because they use a comma as the decimal point.

(This page is part of the online user manual for Parse-O-Matic.  Parse-O-Matic is a programmable parsing tool that can extract, manipulate, convert or mine existing data sources and turn them into importable data.  For more information on Parse-O-Matic products and conversion services, please visit www.ParseOMatic.com)