Canonical representation of certain optimal control problems