Skip to main content

This article explains a resolution to an error during a sort operation.

Problem:

We are receiving an error with an application's internal SORT failing during execution. The error message is:

Execution error : file 'extsm'

error code: 114, pc=0, call=1, seg=0

114 Attempt to access item beyond bounds of memory (Signal 11)

The COBOL syntax was SORT sort-file-name, USING data-file-name GIVING data-file-name.

Resolution:

In reviewing the application source code's SORT statement, there is a size difference between the USER-SORT-FILE and those of MY-FILEs.

SORT USER-SORT-FILE

ASCENDING KEY........

USING MY-FILE-IN,

GIVING MY-FILE-OUT.

The difference is that USER-SORT-FILE is 101 bytes and MY-FILEs are 105 bytes. This size difference is being trapped at runtime as the USING MY-FILE-IN is opened and it's data passed to the SORT record. This size difference causes an out-of-bounds error, a 114 abend, as it attempts to move it into the SORT record buffer.

According to the syntax rules for SORT, there are not supposed to be any such differences. Following is an excerpt from the Language Reference manual regarding this.

General Rule 11 states:

If the USING phrase is specified and the file referenced by file-name-1 contains variable-length records, the size of the records contained in the file referenced by file-name-2 must not be less than the smallest record nor larger than the largest record described for file-name-1. If the file referenced by file-name-1 contains fixed-length records, the size of the records contained in the file referenced by file-name-2 must not be larger than the largest record described for the file referenced by file-name-1.

Old KB# 14009

#netexpress
#COBOL
#RMCOBOL
#ServerExpress
#AcuCobol