  We study $q$-ary codes with distance defined by a partial order of the
coordinates of the codewords. Maximum Distance Separable (MDS) codes in the
poset metric have been studied in a number of earlier works. We consider codes
that are close to MDS codes by the value of their minimum distance. For such
codes, we determine their weight distribution, and in the particular case of
the "ordered metric" characterize distributions of points in the unit cube
defined by the codes. We also give some constructions of codes in the ordered
Hamming space.
