No need for arrays, just redirect the output to a file as you read it.

I've kept it very simple and used RedirectOutput() to save strokes.

Input and ouput is assumed to be CSV (comma "," seperated values)

 Code:
Break ON
 
$=SetOption("Explicit","ON")
Dim $fh,$sFile,$sLine
 
$fh=FreeFileHandle()
$sFile=".\data.csv"
 
If Not Open($fh,$sFile)
	$sLine=ReadLine($fh)
	While Not @ERROR
		$sLine=SPlit($sLine,",")
		If UBound($sLine)=3
			$=RedirectOutput($sLine[3]+".csv")
			Join($sLine,",")+@CRLF
			$=RedirectOutput("")
		EndIf
		$sLine=ReadLine($fh)
	Loop
Else
	"Cannot open "+$sFile+" for reading"+@CRLF
EndIf


This code is 100% tested. \:\/