Positioning and/or locking drive for a casement of a window, a leaf of a door or the like, having a housing, a gear motor comprising a drive unit and a gear unit, an electronic control device for actuating the gear motor and an output element which can be acted on by the gear motor and can be coupled or is coupled to the casement or leaf or a locking device associated with the casement or leaf and the speed and/or position of which can be subjected to open-loop and/or closed-loop control by the electronic control device using respective relative positions of the output element detected by means of a relative or incremental distance measuring device, wherein the drive additionally comprises an absolute distance measuring device for detecting respective absolute positions of the output element and the relative or incremental distance measuring device can be automatically calibrated by the electronic control device by means of the absolute distance measuring device, wherein the respective relative positions of the output element detected by means of the relative or incremental distance measuring device can be buffer-stored in a buffer store of the electronic control device, characterized in that, in the event of a failure of the voltage supply for the electronic control device, the gear motor and/or the buffer store, which failure occurs after a respective calibration of the relative or incremental distance measuring device by means of the absolute distance measuring device and lasts for a specifiable time, comparison between a respective absolute position value detected by means of the absolute distance measuring device and a respective relative position value buffer-stored in the buffer store is automatically performed by the electronic control device, in that, when a deviation between a respective absolute position value detected by means of the absolute distance measuring device and a respective relative position value buffer-stored in the buffer store is established, the output element can be automatically moved by means of the gear motor actuable by the electronic control unit to a safe state in accordance with an absolute position value specifiable by means of the absolute distance measuring device, and in that the position value of the relative or incremental distance measuring device is set to the detected position value of the absolute distance measuring device by the electronic control device following the movement of the drive element to the safe state. wherein the respective relative positions of the output element detected by means of the relative or incremental distance measuring device can be buffer-stored in a buffer store of the electronic control device, characterized in that, in the event of a failure of the voltage supply for the electronic control device, the gear motor and/or the buffer store, which failure occurs after a respective calibration of the relative or incremental distance measuring device by means of the absolute distance measuring device and lasts for a specifiable time, comparison between a respective absolute position value detected by means of the absolute distance measuring device and a respective relative position value buffer-stored in the buffer store is automatically performed by the electronic control device, in that, when a deviation between a respective absolute position value detected by means of the absolute distance measuring device and a respective relative position value buffer-stored in the buffer store is established, the output element can be automatically moved by means of the gear motor actuable by the electronic control unit to a safe state in accordance with an absolute position value specifiable by means of the absolute distance measuring device, and in that the position value of the relative or incremental distance measuring device is set to the detected position value of the absolute distance measuring device by the electronic control device following the movement of the drive element to the safe state.