There are probably a few ways I could modify PokeGen to attempt to detect invalid data like that and ignore the data as a result. The problem is that if the hardware is screwing up the Pokemon, there's no telling what else it's doing the same thing to in the rest of the save file.
As for codes, I don't know how many lines the flash cards can handle in a single code, but the actual Action Replay hardware can only handle around 186 or something like that. That was the reason for making codes individual.
Edit: I'm a bit curious. What steps, exactly, did you take to obtain your save file before opening it with PokeGen?