Embodiments include an implantable medical device (IMD) that includes a control unit, a permanent memory for a device identifier IID, a memory unit that stores a device identifier EID of an external device, a near-field data communication unit and a far-field data communication unit. The control unit, jointly with the near-field data communication unit, detects a third device in the near-field region of the IMD and transmits the device identifier IID of the IMD to the third device. The control unit, following a near-field data communication with a third device, checks any messages received via the far-field data communication unit as to whether the messages include a far-field start message and a device identifier IID of the IMD that corresponds to the device identifier stored in the permanent memory. The control unit sends a far-field response message, which includes the device identifier IID and the device identifier EID.