Skip to main content

Problem:

Program is executing a SORT statement using the following syntaz;

SORT SortFile ASCENDING Data-Item

         USING InputFile

         GIVING OutputFile

The sort statement when executed results in a runtime error 153 - Subscript out of range.

Resolution:

When encountering this type of problem the first thing that should be looked at is the record definition of the sort file, input file and output file.

In this particular case the error was due to the fact the the SortFile record definition length is shorter than the Input File and Output File.

Using this type of syntax you must ensure that the record length of all files are equal.

Old KB# 1502

#RMCOBOL
#netexpress
#ServerExpress
#AcuCobol
#COBOL