Determine if truncation has occurred on a character array
If
you define lname in the customer table with a length
that is longer than 15 characters, nameind contains the actual
length of the lname column. The name host variable contains
the first 15 characters of the lname value. (The string name must
be terminated with a null character.) If the family name of the company
representative with customer_num = 105 is shorter than 15 characters, truncates
only the trailing blanks.
Check for a null value
If company has a null value for
this same customer, compind has a negative value. The contents
of the character array comp cannot be predicted.
The following figure shows the program
that uses the EXEC SQL syntax for the SQL statements.