The discrete-dipole approximation (DDA) is a powerful method for calculating absorption and scattering by targets that have sizes smaller than or comparable to the wavelength of the incident radiation. The DDA can be extended to targets that are singly- or doubly-periodic. We generalize the scattering amplitude matrix and the 4 x 4 Mueller matrix to describe scattering by singly- and doubly-periodic targets, and show how these matrices can be calculated using the DDA. The accuracy of DDA calculations using the open-source code DDSCAT is demonstrated by comparison to exact results for infinite cylinders and infinite slabs. A method for using the DDA solution to obtain fields within and near the target is presented, with results shown for infinite slabs.