← All errors

RNQ

RNQ0121 Array index not valid

RPG status code
00121 Array index not valid

Most common cause

An index lower than 1 or higher than the number of elements in the array.

Other causes

  • A loop with <= instead of <, or a counter not reset.
  • An array loaded from a file with more rows than DIM allows.

How to fix it

Check the index against %ELEM before access. For loads of variable size consider a DIM(*AUTO) array, from 7.4.

Related errors

Text and codes from IBM documentation for 7.6. Checked on .