I would caution that IIRC, parallelizing the For loop where you write your data can *NOT* be depended upon to write the data in the proper order. The execution order of the parallel instances isn't prescribed and is probably unpredictable to mortals.
<EDIT> Dang, did it again. Had a tab open to reply, didn't get around to it immediately, forgot to refresh before posting, found that I was just repeating what was already said. Oh well, maybe two answers reinforces the point...
I did not know writing to an ASCII file could be done in parallel. Did you check that everything is written in the right order?
I would expect that the right order is not guaranteed using a parallel FOR loop.
Yes, definite oversight.
The code is still slightly faster even without the parallelism.
Sorry, i've been a little busy these last days.
Thank you all for your answers and explanations. Your answers helped me a lot, and I was able to update my application and save time during its execution.