When A Comes After 1: Collating Sequences and Data Formats
EBCDIC versus ASCII sort order, packed decimal, zoned signs, binary and floating point: where migrated sorts silently go wrong, with worked byte-level examples.
By Bill Ahlbrandt, President and CEO, Ahlbrandt Software · September 2026
A mainframe sort moved to Linux or Windows can end with return code zero, write exactly the right number of records, and still be wrong. The control statements describe fields by position and format. They don’t say anything about the character set, the byte order or the number formats of the platform that wrote the data. This paper goes through, byte by byte, the things that make a migrated sort come out different: collating sequences, code pages, decimal signs, byte order, floating point, record descriptors and year windows. I computed every byte value and sort order shown here. There are two sound ways to handle it. You can keep the data in EBCDIC and sort it with an engine that reads it the way z/OS does, or you can convert it field by field from the record layout and change the sort to match. Converting whole files to ASCII isn’t one of them.