GT.M defines string subscripts as a variable length sequence of 8-bit ASCII codes ranging from 0 to 255.
To distinguish strings from numerics while preserving collation sequence, GT.M adds a byte containing hexadecimal FF to the front of all string subscripts. GT.M permits the use of the full range of ASCII characters in keys. Therefore, a null (ASCII 0) is an acceptable character in a string.
GT.M handles strings with embedded nulls by mapping 0x00 to 0x0101 and 0x01 to 0x0102. GT.M treats 0x01 as an escape code. This resolves confusion when null is used in a key, and at the same time, maintains proper collating sequence. The following rules apply to character representation:
All codes except 00 and 01 represent the corresponding ASCII value.
00 is a terminator.
01 is an indicator to translate the next code using the following:
|
Escape Code Translation in Keys |
||
|
Code |
Means |
ASCII |
|
01 |
00 |
<NUL> |
|
02 |
01 |
<SOH> |
Example:
Global Variable Name:
----
^NAME("A",$C(2,1,0),"B")
Internal Representation:
------------------------
4E 41 4D 45 00 FF 41 00 FF 02 01 02 01 01 00 FF 42 00 00
N A M E A $C(2) $C(1) $C(0) B