Informix Error -653
-653 Variables declared as LIKE cannot be global.
A global variable was defined as LIKE. LIKE variables must be local variables.
An example of the error follows:
DEFINE GLOBAL var LIKE tab.col; -- error
Correction: Do not use the LIKE keyword with global variables. Instead, specify the data type explicitly.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-653 fires when DEFINE GLOBAL var LIKE tab.col is used — per the official guidance, LIKE
variables (which take their type from an existing column) must be local; a global variable can't
be declared this way.
DEFINE GLOBAL var LIKE tab.col, per the official guidance's own example — the direct, only cause.- A local-variable declaration pattern reused for a global variable without realizing
LIKEisn't supported in that context.
Solutions / Resolution
- Don't use the
LIKEkeyword with global variables, per the official guidance — specify the data type explicitly instead. - Look up the referenced column's actual type to write the explicit type declaration:
SELECT colname, coltype FROM syscolumns WHERE tabid = (SELECT tabid FROM systables WHERE tabname = 'tab') AND colname = 'col'; - If
LIKE's type-following convenience is genuinely wanted, declare the variable as local instead of global, if that's compatible with how it needs to be used.
Examples
The disallowed attempt
DEFINE GLOBAL var LIKE orders.status;
-- -653: LIKE variables must be local
Corrected — explicit type
DEFINE GLOBAL var CHAR(10);
Or corrected — keep it local instead
DEFINE var LIKE orders.status;
Diagnostic Checks
- Scan
DEFINE GLOBALstatements for aLIKEclause, and either switch to an explicit type or, if appropriate, make the variable local instead.
Related Errors / Related Topics
- -652 — "Local variables do not allow default values." Another SPL variable-declaration
restriction tied to scope, about
DEFAULTand locality rather thanLIKEand globality.
LIKE variables must be local — specify the type explicitly for a global, or keep the variable
local if LIKE's convenience is genuinely needed.