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.
| 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 | For Java, the maximum supported by a Java Virtual Machine. For JavaScript, the maximum supported by a browser. For COBOL, 32,767 characters. | 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. |
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.
The following table shows the escape sequences you must use to place certain special characters in a string.
| Escape sequence | Character name |
|---|---|
| \" | Double quotation mark |
| \\ | Backslash |
| \t | Tab |
| \r | Carriage return |
| \f | Line feed |
| \n | Newline |
| \b | Backspace |
var1 String = "This is a string \n that will appear on two lines."
| 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. |