You have fallen over the 256 byte problem. It is documented in the DML
Rference Guide for Obtain Using.
USING
Specifies the sort control element to be used in searching the sorted
set.
sort-key
The symbolic name of a field defined in working storage that contains
the value of the sort control element.
Note: Due to the architecture of the client interface for Advantage
CA-IDMS, 256 bytes will be moved regardless of the actual length of the
working storage sort key. This additional storage should be accounted
for in order to avoid potential program exceptions that can occur. While
these exceptions are rare, they are more probable if the sort-key is
defined in a FILE or LINKAGE SECTION definition. To avoid this problem,
it is recommended that the sort-key be defined in the program's WORKING
STORAGE SECTION, padded to a full 256 bytes; and moved in and out of the
FILE or LINKAGE SECTION fields.
Chris Trayler