Informix Error -2870: The subscripted column size does not match the space allocated in the display field.
Cause and resolution
The subscripted column size does not match the space allocated in the display field.
This attribute statement relates a substring of a column to a display field. However, either the substring numbers are wrong (the first is less than 1 or greater than the size of the column, the second is less than the first), or they are correct but the number of characters that they select is different from the size of the display field. Revise the substring numbers to select exactly as many characters as the field requires.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-2870 fires when an ATTRIBUTES statement relates a substring of a column to a display field,
but the substring specification is wrong — per the official guidance, either the substring
numbers are invalid (the first less than 1, or greater than the column size, or the second
less than the first), or they're valid but select a different character count than the display
field's size.
- Invalid substring bounds (first index below 1 or above the column size, or the second index below the first), per the official guidance — the first named cause.
- Valid substring bounds that select a character count different from the display field's size, per the official guidance — the second named cause.
Solutions / Resolution
- Revise the substring numbers to select exactly as many characters as the field requires, per the official guidance.
Examples
A substring size mismatch
SCREEN
{
Area: [area_code]
}
END
ATTRIBUTES
area_code = phone_number[1,3];
-- -2870: the SCREEN field is only 2 characters wide, but [1,3] selects 3
Corrected
SCREEN
{
Area: [area_code ]
}
END
ATTRIBUTES
area_code = phone_number[1,3];
-- SCREEN field widened to 3 characters, matching the substring
Diagnostic Checks
- Check the substring bounds against both the column's size and the display field's width, and adjust whichever is inconsistent.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -2870 in this set yet.
A column substring's bounds don't match its display field's size — revise the substring numbers or the field width.