One of the most important differences between Unicode and non-Unicode programs is the clear distinction between character-type data objects and byte-type data objects, and the restriction of data types whose objects can be viewed as character-type. This has an influence on all statements in which character-type operands are expected, and in particular on character string and byte string processing.
Character-type data objects
In Unicode programs, only the following elementary data objects are now character-type:
Data type | Meaning |
c | Text field |
d | Date field |
n | Numerical text |
t | Time field |
string | Text string |
In addition, structures are character-type if they contain only flat character-type components (only components from the above table with the exception of text strings).
In Unicode programs, a structure can now essentially only be used at an operand position that expects a single field if the structure is character-type. It is then handled in the same way as a data object of type c.
In non-Unicode programs, all flat structures and byte-type data objects are also still handled as character-type data objects (implicit casting).
Note
The incorrect use of structures at operand positions is greatly restricted in Unicode programs. For example, a structure that contains a numeric component can no longer be used at a numeric operand position.
Byte-type data objects
In Unicode programs, elementary data objects of types x and xstringare byte-type. In non-Unicode programs, data objects of this type are generally handled as character-type. Conversely, in non-Unicode programs, at positions in which byte processing takes place (SET BIT, GET BIT and the logical operators O, Z, M), character-type data objects are still expected, while in Unicode programs only byte-type data objects are permitted.
Note
In Unicode programs, the storage of byte strings in character-type containers causes problems, as the byte order of character-type data objects in Unicode systems is platform dependent. In non-Unicode systems, this only applies for data objects of numeric data types. The content of the data objects is interpreted incorrectly if a container of this type is stored persistently and is then imported to an application server with a different byte sequence.
No comments:
Post a Comment