In your programm, we see no definition of "PortAStatus" !

Why do you put this undeclared value to PortD ?