Informix Error -4331
-4331 Only variables of type INTEGER or SMALLINT may be used to
index display fieldsThis statement uses a subscript to refer to one element of a screen array. However, the subscript variable is not an integer type. Make sure that the subscripting variable is the one you intended to use, and make sure it is defined as INTEGER or SMALLINT.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4331 fires when a subscript referring to one element of a screen array isn't an integer
type — per the official guidance, the subscripting variable must be INTEGER or SMALLINT.
- A screen-array subscript variable that isn't
INTEGER/SMALLINT, per the official guidance — the direct, only cause.
Solutions / Resolution
- Confirm the correct subscripting variable was used, per the official guidance.
- Confirm it's defined as
INTEGERorSMALLINT, per the official guidance.
Examples
A DECIMAL subscript variable
DEFINE row_num DECIMAL(3,0)
DISPLAY rec.field[row_num]
-- -4331: row_num must be INTEGER or SMALLINT
Corrected
DEFINE row_num SMALLINT
DISPLAY rec.field[row_num]
Diagnostic Checks
- Check the declared type of every screen-array subscript variable, and confirm it's
INTEGERorSMALLINT.
Related Errors / Related Topics
- -4327 — "The variable variable-name is not of type INTEGER or SMALLINT. It cannot be
used as a loop index." A related integer-type requirement, about
FORloop indices rather than screen-array subscripts.
A screen-array subscript variable isn't INTEGER/SMALLINT — redeclare it as one of those
types.