A tool for controlling rotation of a bottom hole assembly with respect to
a drillstring has a mandrell with a longitudinal groove and a
circumferential groove extending therearound and in communication with
the longitudinal groove, a locking element extending around and over at
least a portion of the grooves, and an actuator cooperative with the
locking element for selectively moving the locking element such that
locking member extending from the locking element engages either the
longitudinal groove ro the circumferential groove relative to a fluid
pressure in the drillstring.