Tuesday, June 23, 2009

Structure Typing in Unicode Programs

For downward compatibility reasons, a structure can still be cast for field symbols and parameters of function modules and subroutines using the obsolete addition STRUCTURE.

When assigning a data object to such a field symbol or passing an actual parameter to such a formal parameter, in non-Unicode programs, the system only checks whether the length of the data object or actual parameter has at least the length of the structure and whether the alignment is identical at runtime. Unicode programs make a difference between structured and elementary data objects or actual parameters. For a structured data object or actual parameter, its Unicode fragment view must match the cast structure including all alignment gaps (including the closing ones). In addition, an elementary data object or actual parameter must be character-type and flat.

When a formal parameter of a function module is typed with a flat structure using LIKE instead of TYPE, LIKE has the same effect as STRUCTURE. However, the system checks the exact length during the parameter transfer in non-Unicode programs.

Note

The check of the Unicode fragment view can avoid problems that occur in non-Unicode systems due to closing alignment gaps. Example: The filliing of actual parameters with the content of an alignment gap which is not type-specific.

No comments:

Blog Archive