first check the size of the split array by using the UBOUND() command, that would prevent you from trying to pull an nonexistent array field.

code:

break on

$logfile = "D:\TEST.DAT" <-- change this

if open(1,$logfile,2) = 0
$line = readline(1)
while @error = 0
$array = split($line,",")
if ubound($array) < 2
;don't pull the array info! kix will crash!
else
?"Third element = " $array[2]
endif
$line = readline(1)
loop
$ = close(1)
endif

exit 1