The system array VGVar.sqlWarn is an 11-element array, where each element contains a warning byte returned in the SQL communications area (SQLCA) for the last SQL I/O operation and where the index is one greater that the warning number in the SQL SQLCA description. The system variable VGVar.sqlWarn[2], for example, refers to SQLWARN1, which indicates whether characters in an item were truncated in the I/O operation.
Of the elements in VGVar.sqlWarn, only the system variable VGVar.sqlWarn[2] is refreshed by the database management system for Java™ code or at debugging time.
You can use VGVar.sqlWarn in these ways:
VGVar.sqlWarn[2] contains W if the last SQL I/O operation caused the database manager to truncate character data items because of insufficient space in the program's host variables. You can use logical expressions to test whether the values in specific host variables were truncated. For details, see the references to trunc in Logical expressions.
When the host variable is a number, no truncation warning is given. Fractional parts of a number are truncated with no indication.
In the following example, my-char-field is a field in the SQL row record just processed and lost-data is a function that sets an error message indicating that information for my-char-field was truncated.
if (VGVar.sqlWarn[2] == 'W') if (my-char-field is trunc) lost-data(); end end
Related concepts
Segmentation in text applications
SQL support
Related reference
Logical expressions
System variables outside of EGL libraries