Informix Error -1326
-1326 An array variable has been referenced outside of its specified
dimensions.The subscript expression for an array has produced a number that is either less than one or greater than the number of elements in the array. Review the program logic that leads up to this statement to determine how the error was made.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1326 fires when an array subscript evaluates to a value below 1 or beyond the array's declared element count — per the official guidance, this is a program-array indexing error (compare -1107, which is specific to screen arrays in forms).
- A subscript computed as less than 1, per the official guidance — a zero-based indexing assumption against Informix's 1-based array indexing.
- A subscript computed as greater than the array's declared size, per the official guidance — a loop bound or computed index exceeding the array's actual dimensions.
Solutions / Resolution
- Examine the program logic preceding the problematic statement, per the official guidance, to identify how the out-of-bounds reference occurred.
- Correct the subscript computation, or widen the array's declared dimensions if the extra capacity is genuinely needed.
Examples
A loop bound exceeding the array's size
DEFINE v_items ARRAY[10] OF RECORD
item_id INTEGER
END RECORD;
FOR i = 1 TO 11
DISPLAY v_items[i].item_id
END FOR
-- -1326: v_items only has 10 elements; i reaches 11
Diagnostic Checks
- Trace the subscript computation leading to the failing reference, and compare against the array's declared dimensions.
Related Errors / Related Topics
- -1107 — "Field subscript out of bounds." A related array-indexing error, specific to
screen arrays referenced in
INPUT/DISPLAY/CONSTRUCTstatements rather than program arrays generally.
A program array subscript fell outside 1..N (N = the array's declared size) — trace the computation that produced it.