Waltham-based Rocket Software has agreed to buy a Canadian business for more than $2.2 billion, one of the year’s largest acquisition deals in the Bay State’s enterprise software space.