Informix Error -4831: The variable var_name is not of type INTEGER or SMALLINT. It cannot be used to store offset bytes returned from the seek operation.
Cause and resolution
The variable var_name is not of type INTEGER or SMALLINT. It cannot be used to store offset bytes returned from the seek operation.
The variable used to store the offset bytes returned from the seek operation must be an integer type. Specify a different variable, or redefine the one named.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4831 fires when a variable used to receive a Seek operation's returned offset isn't
declared INTEGER or SMALLINT — per the official guidance.
- A non-integer-type variable used to hold a seek offset, per the official guidance — the direct, only cause.
Solutions / Resolution
- Specify a different variable, or redefine the one named, per the official guidance,
as
INTEGERorSMALLINT.
Examples
A non-integer offset variable
DEFINE pos CHAR(10)
CALL f.seek(fd, 0, pos)
-- -4831: pos must be INTEGER or SMALLINT
Corrected
DEFINE pos INTEGER
CALL f.seek(fd, 0, pos)
Diagnostic Checks
- Check the declared type of every variable receiving a seek offset, and change it to
INTEGERorSMALLINTif it isn't already.
Related Errors / Related Topics
- -4830 — "The variable var_name is not of type INTEGER or SMALLINT. It cannot be used as a file descriptor." The same underlying type restriction, for a file-descriptor variable rather than a seek-offset destination.
- -4825 — "Seek on file file_name cannot be done." A related seek error, about the seek operation itself failing rather than the offset destination's type.
A variable used to store a seek offset isn't INTEGER/SMALLINT — redefine it as one.