The focusing properties of long magnetic lenses. I