The ForEach … File statement is used to process lines from a file.
Syntax
ForEach Line
File "path\filename"
Do
... ;
Od;
ForEach Line This variable is declared as Text. Common practice is to use Line as variable name because it will contain the current line at each passing.File "path\filename" This is the file path and name. Each line of this file will be used to execute the part Do ... Od.... ; Repeating code
The file is read as an ASCII file. Every line is assigned to the variable before the Do … Od is executed.
The Break command can be used to terminate the loop unconditionally.
Example
Var Text Line;
ForEach Line
File "c:\temp\itplog"
Do
Progress Message (Line);
Od;
This will read the file c:\temp\itplog and send every line back to the client as a separate message.