Just at a glance, the code snippet below:
while(done = 0)
{
fileReadln(fh1, str1)
fileReadln(fh2, str2)
fileReadln(fh3, str3)
if((@Len(str1) > 0) and (@Len(str2) > 0) and (@Len(str3) > 0) and (@Len(str4) > 0) and (@Len(str5) > 0))
{
str_out = str1 + ", " + str2 + ", " + str3 + ", " + str4 + ", " + str5
fileWriteln(fh_out, str_out)
}
else
{
done = 1
}
}
is reading in three lines, but checking the length and trying to concatenate five.
Try altering it so it is consistently either three or five:
while(done = 0)
{
fileReadln(fh1, str1)
fileReadln(fh2, str2)
fileReadln(fh3, str3)
if((@Len(str1) > 0) and (@Len(str2) > 0) and (@Len(str3) > 0))
{
str_out = str1 + ", " + str2 + ", " + str3
fileWriteln(fh_out, str_out)
}
else
{
done = 1
}
}
BTW - the code as you pasted it here, doesn't compile because you are using at least two variables that were declared in my example, but when you went from five to three lines, you deleted the declarations for two of them (str4 and str5).
Also - especially important: when you write a Mass Update, you do not put the code directly into the element. You need to put the code into the programming editor. Instructions for writing and running a mass update start on page 264 of the manual.