Informix Error -4345: The variable variable-name has already had substrings applied to it.
Cause and resolution
The variable variable-name has already had substrings applied to it.
The name that is shown is followed by one substring expression (two numbers in square brackets) and then by another. This is not valid. Perhaps some punctuation was deleted accidentally in editing the name of another variable. Or if you meant this to be a subscript of a two-dimensional array of character items followed by a substring of the chosen element, the problem is that variable-name has not been defined as an array.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4345 fires when a variable name is followed by two substring expressions in sequence — per the official guidance, this may be a punctuation mistake from editing, or, if a two-dimensional character array subscript followed by a substring of the chosen element was intended, the underlying problem is that the variable isn't actually defined as an array.
- Two substring expressions applied to the same variable in sequence, per the official guidance — the direct, only cause.
- A variable not defined as an array, when a subscript-then-substring combination was intended, per the official guidance — a specifically named related cause.
Solutions / Resolution
- Check whether punctuation was accidentally deleted while editing, per the official guidance.
- If a two-dimensional array element's substring was intended, confirm the variable is genuinely defined as an array, per the official guidance.
Examples
Two substring expressions in sequence
DEFINE code CHAR(20)
LET x = code[1,10][1,5]
-- -4345: two substring expressions applied to the same variable
Corrected
LET x = code[1,5]
Diagnostic Checks
- Check every variable followed by more than one bracketed expression in sequence, and simplify to a single substring, or confirm array declaration if a subscript-then-substring was intended.
Related Errors / Related Topics
- -4344 — "The variable variable-name cannot be used with substrings because it is not a character variable." A related substring-usage error, about the variable's type rather than applying substrings twice.
Two substring expressions are applied to the same variable in sequence — simplify to one, or confirm the variable is an array if a subscript-then-substring was intended.