Did you learn nothing in middle school biology? Sex is determined immediately when the sperm enters the ovum. Some sperm carry X chromosomes, and some carry Y. Every fetus already has a gender.
As far as fish feeling pain - HELL YES, they do. Anyone who works at an aquarium or with fish in some way could tell you that (myself included).
And yes, it does hurt them when they get hooked, especially if it's in the gills (damaged gill tissue means less respiration => less oxygen going into the blood stream). Has anyone ever had lung damage, like a punctured or collapsed lung or something? Same concept.