Character types

In the current internationalized marketplace, it is particularly vital to be conscious of the encoding you use with character or text type data. EGL provides a variety of encoding types for single-byte, double-byte, and multibyte characters. Note that you can also refer to subsets of these character types as substrings; see Substrings.

Table 1. Primitive character types
Primitive Size Limits Data type
CHAR 1 byte CHAR(32767) Single-byte characters using local code page encoding
DBCHAR 2 bytes DBCHAR(16383) Double-byte characters using local code page encoding (cannot contain single-byte characters)
MBCHAR 1 or 2 bytes MBCHAR(32767) MBCS data. Double byte characters are recognized because the lead byte belongs to a reserved set. Specify length in single bytes.
STRING varies* 16,383 characters of content Unicode (UTF-16 encoding) characters.
UNICODE 2 bytes UNICODE(16383) Unicode (UTF-16 encoding) characters.
HEX 4 bits HEX(65534) Hexadecimal digits 0-9 and A-F.
You can specify a STRING with a specific number of characters, in which case it is a limited-length string, or you can declare a variable-length string by omitting the length specification, as in the following examples:
myLimitedString STRING(25);
myVarString STRING;

In the above example, myLimitedString is different from a CHAR(25) variable because STRINGs contain Unicode data while CHARs contain data in the native character set. Limited-length strings are most commonly used to map to the SQL VARCHAR type.

Escape sequences for strings

The following table shows the escape sequences you must use to place certain special characters in a string.

Table 2. Escape sequences for strings
Escape sequence Character name
\" Double quotation mark
\\ Backslash
\t Tab
\r Carriage return
\f Line feed
\n Newline
\b Backspace
The following example includes the newline character:
var1 String = "This is a string \n that will appear on two lines."

Compatibility considerations

Table 3. Compatibility considerations
Platform Issue
JavaScript generation The following types are supported: ANY, BIGINT, BIN (but only in the absence of decimal places), Boolean, DataItem, DATE, DECIMAL, Delegate, Dictionary, FLOAT, INT, NUM, NUMBER, SMALLFLOAT, SMALLINT, STRING (but only in the absence of a size limit) , TIME, TIMESTAMP, NUM, MONEY, Service parts, Interface parts, External types (stereotype JavaScript), arrays of supported types, and non-structured Basic, Exception, and SQL Record parts.

The following types are not supported: ArrayDictionary, BIN (with decimal places), BLOB, CHAR, CLOB, DBCHAR, HEX, INTERVAL, MBCHAR, NUMC, STRING (with a size limit), PACF, UNICODE, and structured Record parts.


Feedback