Shearing of monolayer and bilayer monatomic films confined between planar solid surfaces (walls) is simulated by a Monte Carlo technique in the isostress-isostrain ensemble, where temperature, number of film atoms, and applied normal stress are state variables. The walls consist of individual atoms that are identical with the film atoms and are fixed in the fcc (face centered cubic) (100) configuration. The lattice constant l of the walls is varied so that the walls are either commensurate with the (solid) film at fixed nominal lattice constant ${\mathit{l}}_{\mathit{f}}$ (i.e., l/${\mathit{l}}_{\mathit{f}}$=1) or homogeneously compressed (l/${\mathit{l}}_{\mathit{f}}$1) or stretched (l/${\mathit{l}}_{\mathit{f}}$>1). Such rheological properties as shear stress ${\mathit{T}}_{\mathit{z}\mathit{x}}$ and modulus are correlated with molecular structure of the layers, as reflected in translational and orientational correlation functions. If the walls are properly aligned in transverse directions, then the layers exhibit a high degree of fcc order. As such ordered films are subjected to a shear strain (by reversibly moving the walls out of alignment), they respond initially as an elastic solid: at small strains, ${\mathit{T}}_{\mathit{z}\mathit{x}}$ depends linearly on the strain. As the shear strain increases, the response becomes highly nonlinear: ${\mathit{T}}_{\mathit{z}\mathit{x}}$ rises to a maximum (yield point) and then decays monotonically to zero, where the maximum misalignment of the walls occurs. The correlation functions indicate that the films are not necessarily solid, even when the walls are in proper alignment. The results suggest that the principal mechanism by which disordered nonsolid films are able to resist shearing is ``pinning'': the film atoms are trapped in effective cages formed by their near neighbors and the mutual attraction of the walls for the caged atoms pins them together.