Above is an example of a file I am trying to sort. I want to sort by the 2nd and 3rd characters, of the right table (01, 04, etc). The first character in the right table is a record type (1 or 2) The last character in the right table is a sequence number, which only applies to the 2 type records. For each 1 type record, there are up to 6 corresponding and related 2 type records, which must follow the type 1 records, in sequence order, (1-6) The sort field (01, 04, etc) is common to both types of records, and in the same byte locations, but come in a file where they are not sequentially ordered. How can I sort this, so that the sort field I want is in ascending order, but yet the type 2 records that correspond are kept in sequential order, below each type 1 type record?