Tuesday, June 23, 2009

Alignment in Unicode Systems

In Unicode systems, in addition to the alignment requirements for numeric data objects of types i, decfloat16, decfloat34, and f and of deep data objects, all character-type data types are also affected. The alignment is determined by the length requirement of a character in the memory.

As a consequence, in structures with components of different data types, the alignment gaps in Unicode systems may be different to those in non Unicode systems. For enhancements between structures, the Unicode fragment view concept has been introduced, which divides a structure into fragments according to its alignment gaps.

Note

Alignment gaps can also occur at the end of structures, as the overall length of the structure is determined by the component with the largest alignment requirement.

Example

In the following structure, alignment gaps (A) occur in Unicode systems that are not present in non-Unicode systems. The first alignment gap is formed as a result of the alignment of the substructure struc2, the second due to the alignment of the component c of type c>, and the third is due to the component d of type i.

BEGIN OF struc1
a TYPE x LENGTH 1,
BEGIN OF struc2
b TYPE x LENGTH 1,
c TYPE c LENGTH 6,
END OF struc2
d TYPE i,
END OF struc1

Non-Unicode system [ a | b | cccccc | dddd ]
Unicode system [ a | A | b | A | cccccccccccc | AA | dddd ]

No comments:

Blog Archive