definable cursor code updates from Jim Knoble <jmknoble@pobox.com>