Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

8.4.3 UAP execution using the Unicode functionality of COBOL2002

For UAPs that use the Unicode functionality of COBOL2002, you can use Japanese data items for storing UTF-16 character data as embedded variables.

Organization of this subsection
(1) Character codes of SQL-related character data
(2) Character code conversion performed by the HiRDB server
(3) SQL execution conditions

(1) Character codes of SQL-related character data

The following table shows the character codes and character data in UAPs that use the Unicode functionality of COBOL2002.

Table 8-27 Character codes and character data in UAPs that use the Unicode functionality of COBOL2002

Character data in UAP Character codes
SQL statements UTF-8
Embedded variables Alphanumeric data items UTF-8
Japanese data items UTF-16LE or UTF-16BE

(2) Character code conversion performed by the HiRDB server

The following table describes the character code conversion performed by the HiRDB server when UAPs that use the Unicode functionality of COBOL2002 execute SQL statements.

Table 8-28 Character code conversion performed by the HiRDB server when UAPs that use the Unicode functionality of COBOL2002 execute SQL statements.

Character data in UAP Character code conversion performed by the HiRDB server when SQL statements are executed
SQL statement No conversion is performed because the client and server both use UTF-8 character codes.
Embedded variable Alphanumeric data item Character codes are converted if the character set of character data used by the server that is subject to assignment and comparison processing is UTF-16.#
Japanese data item Character codes are converted if the character set of character data used by the server that is subject to assignment and comparison processing is the default character set (UTF-8).#
If the pre-conversion data contains single-byte characters, the single-byte characters (double-byte characters in UTF-16) are stored.
Data in embedded variables is treated as having the character data type (CHAR or VARCHAR) for which the character set name, UTF-16LE or UTF-16BE, has been specified according to the -XU16 option.

#
For details about the data types that can be converted (assigned and compared), see the manual HiRDB Version 9 SQL Reference.

(3) SQL execution conditions

In order to execute the SQL statements by a UAP that uses the Unicode functionality of COBOL2002, all the following conditions must be satisfied:

(a) HiRDB server's default character set

If you specify utf-8 as the character code classification in the pdntenv command (in the UNIX edition, pdsetup command), the HiRDB server's default character set is set to UTF-8.

(b) Preprocessing options

For details about the -XU16 option, see Table 8-5 Preprocessing options (for COBOL in the UNIX environment) or Table 8-11 Preprocessing options (for COBOL in the Windows environment).

(c) Limitations to the characters in embedded SQL statements

An error will occur during preprocessing if an embedded SQL statement in the UAP source contains characters in JIS X0213 level 3 or 4 kanji codes. For character data stored in embedded variables, you must use characters in the range supported by the Unicode functionality of COBOL2002.

(d) Client environment definition

You must specify NOUSE in the PDCLTCNVMODE client environment definition in order to prevent the HiRDB client from performing character code conversion.