I get a bunch of CSV file extracts each month that I am need to consolidate to save time for the person processing them. Each file sits in a subdirectory from the root level, and has a header row in each file. I've got the code working fine, but I've been informed that they need the header row included in the consolidation file.

The question is how do I include a header in the file? My current loop is below.

 Code:
$headerline = "yes"

While $CutoverLog <> "" and @Error = 0
	Open (1, $pcclist + $CutoverLog + "\" + $CutoverLog + "_Details_" + $year + $month + ".csv")
	? "Opening " + $pcclist + $CutoverLog + "\" + $CutoverLog + "_Details_" + $year + $month + ".csv"
	?
	Open (2, $TransactLog, 5)

	$Complete = False
	
	If $headerline = "no"
		$Line = Readline (1)
		$line = ""
	endIf
	
	$headerline = "no"
	
	While $Complete = False
		$Line = Readline (1)
			
			If $Line <> " " and @Error = 0
				Gosub WriteLog
			Else
				$Complete = True
			EndIf			
	Loop
	
	Close (1)
	Close (2)
	
	Del $CutoverLog
	
	$CutoverLog = Dir()
Loop


Many thanks in advance for any ideas, as I'm a bit stuck.

Pax