HPCC-9899 Ensure all FOR loops use local variables 

FOR (x=y should be FOR(VAR x

Fixes HPCC-9899

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>