  We calculate the field dependence of the critical current for the dense
Josephson vortex lattice which is created by large magnetic field $B$ applied
along the layers of atomically layered superconductors. In clean samples a
finite critical current appears due to the interaction of the lattice with the
boundaries. The boundary induces an alternating deformation of the lattice
decaying inside the sample at the typical length, which is larger than the
Josephson length and increases proportional to the magnetic field. The exact
shape of this deformation and the total current flowing along the surface are
uniquely determined by the position of the lattice in the bulk. The total
maximum Josephson current has overall 1/B dependence with strong oscillations.
In contrast to the well-known Fraunhofer dependence, the period of oscillations
corresponds to adding \emph{one flux quantum per two junctions}. Due to
interaction with the boundaries, the flux-flow voltage for slow lattice motion
also oscillates with field, in agreement with recent experiments.
