To determine if the drug combination sulfamethoxazole-trimethoprim (SMX-TMP), given by mouth, and the drug pentamidine (PEN), given by inhaled aerosol, are effective in preventing a relapse of Pneumocystis carinii pneumonia (PCP) when they are given to patients who have recovered from a first episode of PCP and are being given zidovudine (AZT) to treat primary HIV infection.