The keyword instruction INTERPRET

If you're using an INTERPRET instruction in a loop, you should execute the complete loop using INTERPRET. This latter method results in greater efficiency.
Example:
In the routine ReadTextFile I use the following code sequence to read the file:

 
                        /* create the code to read the file           */
  rtf.__iLine = ,
   "do i = 1 until lines( """ || rtf.__fileName || """ ) = 0; "  ,
      rtf.__StemName || "i = lineIn( '" || rtf.__fileName || "');" ,
   "end;"
                        /* and now execute the code to read the file  */
  interpret rtf.__iLine

If I replace this code with the sequence

 
                        /* read the file                              */
  do i = 1 until lines( rtf.__fileName ) = 0
    rtf.__iLine = rtf.__StemName || i " = lineIn( rtf.__fileName )"
    interpret rtf.__iLine
  end /* do i = 1 ... */

the routine needs about three times longer to read a file!


[Back: The keyword instruction EXPOSE]
[Next: The keyword instruction PROCEDURE]