Originally Posted By: 1984
Richard:
Nothing happens!


Well, I tested it (again) and it works fine.

Are your files comma (",") delimited?
Did you run the script from the command line?
Are there 4 fields on each line as in your example?

Here is the script again, but with a little more debugging information:
 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
		"Processing line: "+$sLine+@CRLF
		$sLine=SPlit($sLine,",")
		If UBound($sLine)=3
			$=RedirectOutput($sLine[3]+".csv")
			Join($sLine,",")+@CRLF
			$=RedirectOutput("")
		Else
			"ERROR: Number of fields on this line <> 4"+@CRLF
			Exit 1
		EndIf
		$sLine=ReadLine($fh)
	Loop
Else
	"Cannot open "+$sFile+" for reading"+@CRLF
EndIf