String modes - character-based and legacy
In legacy string mode, only the byte limit is considered; in character-based string mode, also the character limit of the string is considered. The difference between the two observed values is known as the legacy tail, which consists of any characters beyond the string’s character limit. In legacy string mode, this tail is shown as an integral part of the string value, whereas in character-based string mode, the tail is not shown.
Character Based Value
In character-based string mode, this is the default value.
The value represents a string whose number of characters does not exceed the defined character limit.
Example: For a string defined as globalmb(14) MB fixed, globalmb always contains up to 14 character positions, including any trailing spaces.
Legacy Value
This value concatenates the Character Based Value and the Tail Value.
In legacy string mode, the bshell typically uses this string value when performing operations such as comparing it with another string.
Tail Value
This value is known as the legacy tail and consists of the additional bytes that go beyond the Character Based Value. For example, if a string has a character limit of 14 (with a corresponding byte limit of 56, calculated as 14 × 4), and the string contains 11 multibyte (MB) characters and 3 single-byte (SB) characters, the legacy tail will contain 9 bytes, determined by the formula: 56 - (11 × 4 + 3).
Rendered Value
Each string has a display width—the number of positions required to show the string in a fixed-width font. Individual characters can have a display width of 0, 1, or 2. The display width of a string is the sum of the display widths of its characters.
If the MB string is fixed and its display width is shorter than the character limit, the remaining positions are filled with trailing spaces.
This result is called the Rendered Value.