We have prepared the compounds GdNi2B2C and GdCo2B2C and investigated their magnetic properties by means of 155Gd Mössbauer spectroscopy. From the temperature dependence of the hyperfine field, we derived that these two compounds give rise to magnetic ordering at 5.5±0.5 K and 21±1 K respectively. Large values of the electric field gradient Vzz were found, reminiscent of compounds of the related ThCr2Si2 type. A quantitative explanation of the origin of these field gradients is presented by ab initio band structure calculations. The experimental values of Vzz have been used to estimate values for the second-order crystal field parameter in GdNi2B2C (A2 0=-428Ka0 -2) and GdCo2B2C (A2 0=-346Ka0 -2).