The "Electric Shift Control Module" (just a couple of relays in a box) is in the center of the 97 dash. If you pull the radio out, you should be able to see it. Look for a 10-position connector with seven positions filled.
The actual control of the shift motor and feedback position sensing are done by the Generic Electronic Module which also controls a number of other functions throughout the truck. The GEM is also in the center dash area but it is larger and has 4 large electrical connectors with several dozen wires.
If you want to go with the odds, most shifting problems with the Ranger electric transfer case are caused by the Shift Motor/Encoder down on the transfer case. There are a number of repair how-to's available online.