My GUESS is that since you are using the comma as a delimiter, it is reading until it finds a comma. so really, your variable z is being set to everything between the 2nd and 3rd comma - including the newline.
What you need to do is read the file a line at a time, and then break each of those lines apart.
it may be possible (i really don't know) to set a comma OR a newline as a delimiter. I'd suggest reading the API.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors