Modulation constraints of practically any degree of complexity can be described by a state transition table with a finite number (Omega) of states. Examples include all (d,k;c) codes (where (Omega) <EQ 2(k + 1)(2c + 1)), more general codes with run-length limitations, and run- length limited codes which exclude certain bit-patterns. From the state transition table we construct a trellis diagram for code words of arbitrary length LO. If desired, the trellis may be confined in the beginning and/or at the end to a subset of states. We then show a simple method of enumeration that assigns a number to each code word in the trellis according to is lexicographic order. All the necessary information for enumerative encoding and decoding of binary data will be subsequently stored in an array of size LO X (Omega) ; both encoding and decoding can be achieved with a few simple operations using this table. In short, arbitrarily long blocks of data can be encoded into sequences that satisfy arbitrary constraints, with algorithms that are easy to implement. Since no additional constraints are imposed, the rates approach Shannon's noiseless channel capacity in the limit of long sequences. We present ideas for correction of random errors that occur in modulated sequences, so that errors in readout can be corrected prior to demodulation. The post-modulation error correction codes are necessary when modulation code words are long, in which case small errors can destroy large quantities of data. Also introduced in this paper is a simple, efficient algorithm for burst-error-correction. The primary application of the ideas of this paper is in the area of data encoding/decoding as applied in magnetic and optical data storage systems.