in reply to Cannot open file within a loop

Some comments: