The transition from superconducting to antiferromagnetic behavior in RE Ba2Cu3OTHx, RE = Y, Gd, has been studied by Cu NMR and NQR. In the Gd compounds the spectra of Cu(l) and Cu(2) sites could be separated by the strong relaxation induced by the magnetic moments of Gd on the neighboring Cu(2) sites. Already at small x of about 0.4, antiferromagnetic Cu(2) sites are revealed by an AF-NMR spectrum. At the same x we find a strong broadening of the normal NQR spectrum and a new sharp line at 27 MHz for 63Cu, indicating a new EFG of the Cu(1) sites in the AF phase. The transformation to the AF state is complete at about x= 2.0. Annealing of the doped material at 350 ~ leads to the normal oxygen-depleted 123 compounds, proving that the cation lattice is not distorted even at high x. As in the case of the pure YBCO, no static magnetic moments exist at the Cu(1) sites of the hydrogencontaining phase. Hydrogen addition is found to produce a similar antiferromagnetic spectrum in 124 material.KEY WORDS: NQR in YBCO; AFNMR in YBCO; magnetic transition in hydrided 123; magnetic transition in hydrided 124.