Note: Manual Read commands are not supported by all Parse-O-Matic applications.In general,if the application does some preprocessing of the data,the Manual Read commands are not available.

This prevents the script from interfering with the underlying application.Manual Read commands are supported by the Parse-O-Matic Power Tool and Parse-O-Matic Advanced application,since it simply passes unaltered input data directly to the script via the $Data variable.
 
Overview
 
Most Parse-O-Matic applications read a file from top to bottom and feed the input file data to the script one record at a time.In most cases there is no need for Parse-O-Matic to behave differently.However, occasionally a parsing challenge arises in which the script writer needs to go backwards and forwards in a file,or needs to read in new data according to varying criteria.The Manual Read commands address these requirements.
 
RecLenZero Scripts
 
Manual Read commands are essential is when your script is figuring out for itself how many characters to get for each record.In such case,your script must configure the input file as binary and specify a record length of zero.This is known as a RecLenZero script.Here is a sample script.
Config
$CfgInpFileType ='Binary'
$CfgRecLen
End
$Data =ReadFor 100 'Relaxed'
OutEnd $Data
With a record length of zero,the Parse-O-Matic application will never read a single byte from the input file. Thus,the first line of the Main step in a RecLenZero script is typically a ReadFor or ReadUntil command. These commands and others are described below.
 
Using Manual Read for Standard Input File Types
 
Most Manual Read commands work in the standard input modes (such as TextCR)and one of them (ReadNext)does not do anything in a RecLenZero script (i.e.when $CfgRecLen is set to zero).Once again,the crucial factor here is that these commands are not available in Parse-O-Matic applications that preprocess the input file in some way.
 
Bookmark
 
Format Bookmark v1 v2
Example Bookmark 'Save''MyBookmark'
Purpose Remembers or returns to the current position in the input file
Parameters v1 -'Save'or 'Goto'
v2 -The name of the bookmark
Similar Cmds Rewind
Notes The number of bookmarks you can save is limited only by your
computer's memory.
 
ReadEOF
 
Format ReadEOF
Example TestEOF =ReadEOF
Purpose Tests if the file pointer is positioned at the end of the
input file
Similar Cmds The $EndOfData variable
Notes Returns 'Y'if at end of file,'N'otherwise.
Since ReadEOF is a function,it cannot be used in a comparison command such as If or Begin.You can use the special variable $EndOfData for that purpose,or you can save the value of ReadEOF in a variable for later use.Both methods are useful for determining if the input file contains any more data.
 
ReadFor
 
Format v1 =ReadFor v2 [v3 ]
Example MyVar =ReadFor 1000 'Relaxed'
Purpose Reads the specified number of bytes from the input file
Parameters v1 -Variable being set
v2 -Number of bytes to read
v3 -Control setting
Controls Strict/Relaxed
Defaults v3 ='Strict'
Similar Cmds ReadUntil,Rewind
Notes ReadFor does not update Data or PrevData.
If v2 is zero or negative,v1 is set to null.
If v3 is 'Relaxed',no error message is generated if you
attempt to read past the end of the file.
 
ReadNext
 
Format ReadNext
Purpose Moves to the next record in the input file
Similar Cmds ReadUntil, ReadFor
The ReadNext command updates $Data with the next record from the input file.This is helpful if you know
for certain what kind of data will be in the next record and wish to process it at the current point in the script.

ReadNext cannot be used in RecLenZero scripts,since when $CfgRecLen is set to zero Parse-O-Matic
does not know how you are defining a “record ”.In such case you should use a command such as ReadUntil
or ReadFor.
 
ReadUntil
 
Format v1 =ReadUntil v2 [v3 ]
Example MyData =ReadUntil #13#10 'Relaxed'
Purpose Reads from the input file until the specified string is found
Parameters v1 -Variable being set
v2 -String to search for
v3 =Control settings
Controls Include/Exclude;Strict/Relaxed
Defaults v3 ='Exclude Strict'
Similar Cmds ReadFor
Notes In Include mode,the string being sought is included in v1.
If v2 is null,the program will terminate with an error message.
If v3 is 'Relaxed',no error message is generated if you attempt
to read past the end of the file.
 
Rewind
 
Format Rewind v1
Example Rewind 100
Purpose Moves the input file's pointer back by the specified number
of bytes
Parameters v1 -Number of bytes to move backwards (0 =start of file)
Similar Cmds Bookmark,ReadFor
Rewind ignores the sign of v1,so 123 and -123 are treated the same way.If you wish to move forward in the
file,use the ReadFor command.

Rewind resets the $EndOfData condition,but this needs to be done before the script ends or else you will
move on to the FileDone step.

(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)