STRING versus CHAR/VARCHAR

Genero Business Development Language (BDL) introduces a new data type named STRING, which is similar to VARCHAR, but without a size limit. The STRING data type does not exist in IBM® Informix® 4GL. The STRING data type implementation is optimized for memory usage; unlike CHAR/VARCHAR, BDL will only allocate the memory needed to hold the actual character string value in a STRING variable.

A STRING variable is typically used within utility functions (for example, to hold the path to a file). Another typical usage is with CONSTRUCT, to hold the SQL condition. The STRING variable can then be completed to build the SQL text and passed to the PREPARE or DECLARE instruction.

However, because of SQL assignment and comparison rules, the STRING variables cannot be used as SQL parameters in the USING clause of EXECUTE or OPEN/ FOREACH, not can it be used to receive fetched data with the FETCH instruction: For SQL statements, use CHAR or VARCHAR data types.

The STRING data type has a number of built-in methods e.g. getLength() that will are very useful and will reduce source code.