Calculations of the giant dipole resonance for sd-shell nuclei in the open-shell random phase approximation