This document covers the following topics:
There is no impact of Unicode on existing applications. This
means that existing Natural applications should execute without any changes.
Make sure that the parameters
CP are set to
OFF. In this case, it is not necessary to install any of the
components supplied with International Components for Unicode for Software AG
(ICS). Only the I/O buffers have been noticeably increased since the attributes
have been enhanced to support potential Unicode fields. If
CP is set to
OFF, the system variable
is cleared and the well-known translation tables (such as standard table or
alternative table) are continued to be used for I/O translations.
Natural has been extended so that the code page information can be defined on several levels:
The Natural profile parameter
CP defines the default
Natural code page.
For several objects (Natural sources, Natural batch input/output files, print reports, Adabas files) an object-specific code page can be defined.
If neither an object-specific code page nor a default code page is
defined (that is,
CP=OFF applies), Natural does not
convert any data.
Since it is not possible to identify the correct code page automatically, it is important that you define the required code page information yourself. The following scenarios are possible:
|All data is available in the operating system's code page.||No effort||No action.|
|All data is stored with one code page, but this code page differs from the operating system's code page.||Easy||The Natural profile parameter
|The data is available in different code pages.||Depends on the number of sources and code pages||The correct code page has to be defined for every Natural object:|
|Different code pages are mixed in one object (for example, in a source)||High||The object has to be rewritten in the appropriate code page format.|
Sources which have been saved or stowed with previous Natural versions do not have code page information. The code page field of the directory is empty.
Since Natural sources are not saved in Unicode format, the source
has to be converted into the default code page (value of the system variable
that applies to the session. If code page support is switched off
CP=OFF), the code page information of the source is
ignored and no conversion is performed. Alphanumeric constants have to be
adjusted to the default code page when they are loaded into the source area.
Since Natural sources are not saved in Unicode format, alphanumeric
constants have to be adjusted to the default code page during start of the
object. This can be achieved with the
compiler option. If
CPAGE is set to
ON, an additional
table is generated into the object. The Natural loader uses this table to
convert every alphanumeric constant to the default code page (value of the
Depending on the amount of alphanumeric constants, the additional table
increases the size of the resulting object and the conversion consumes
additional CPU time.
It is important that dependent objects (for example, a program and a local data area used by the program) use the same code page. If dependent objects use different code pages, it should be ascertained that the used characters (for example, "#") are mapped to the same code points in the used code pages. The following objects and data do not have an associated object-specific or data-specific code page:
Data definition modules (DDMs),
Predict XRef data.
Care should be taken if such data is used in or produced by objects
for which an object-specific code page has been defined. If the application
itself does not necessarily have to be code page enabled and you want the
application to be code page sensitive with respect to the data that is being
processed, you should consider to use the profile parameter
with the value
It is easy to extend existing applications with new source code based on the U format. The following rules have to be regarded for the U format (as compared with the A format):
REDEFINE of U to a format
other than U should be avoided because this may result in split characters.
U format is endian-dependent. This has to be considered when moving between the formats B and U.
Keep in mind that characters may be lost when moving U to A.
If you want to change existing fields from A format to U format, the following rules have to be regarded:
Code which assumes a specific encoding of strings has to be changed (for example, comparison with a B field).
REDEFINE statements of the
field have to be checked for their validity.
REDEFINE to N is not possible (that is: you will
not get the expected result).
The database field has to be migrated to Unicode (provided that this is supported by your database).
You may have to change the length of the field: if the A field contains DBCS characters, half the length is required for the U field.
CP is used in
conjunction with the parameter macro
(in the source module
to specify the name of the default code page for Natural data or to
automatically take the code page name from the user terminal.