We study a diffusive superconductor–normal-metal–superconductor (SNS) junction in an external magnetic field. In the limit of a long junction, we find that the form of the dependence of the Josephson current on the field and on the length of the junction depends on the ratio between the junction width and the length associated with the magnetic field. A certain critical ratio between these two length scales separates two different regimes. In narrow junctions, the critical current exhibits a pure decay as a function of the junction length or of the magnetic field. In wide junctions, the critical current exhibits damped oscillations as a function of the same parameters. This damped oscillating behavior differs from the Fraunhofer behavior typical for short or tunnel junctions. In wide and long junctions, superconducting pair correlations and supercurrent are localized along the edges of the junction.