Skip to main content

Program gives error 153 (subscript out of range) during execution

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

A customer migrating from the mainframe found that some of his programs were failing with the above error during execution. This was due to PERFORM VARYING statements where the subscript either started at zero, or went past the highest value in a table (e.g. went to 11 when the OCCURS was 10). Whilst he appreciated that such programming practices might be considered unsatisfactory, it was important that the programs should run, unmodified, on the new UNIX platform.

Resolution:

The compiler directive NOBOUND stops the automatic checking of subscripts at runtime (the default is BOUND). If you are building to generated code, you should also look at the NOBOUNDOPT directve, though using this may impact performance.

Old KB# 4538