OpenESQL Globalization Best Practices

OpenESQL supports the use of international data with COBOL host variables in a variety of different ways. International data is stored in the columns of a DBMS as UTF-16, UTF-8 or MBCS (Mixed- or Multi-byte Character Set). The locale for a DBMS client application can also be international, typically MBCS or UTF-8.

When an OpenESQL COBOL application issues a request to a DBMS to send or return international data to or from a host variable, OpenESQL determines the appropriate COBOL host variable content based on the host variable declaration itself and locale of your DBMS client application.

We strongly recommend that to avoid data loss, you match the locale of your DBMS client application with the international encoding specification for the DBMS, and that you select the most appropriate COBOL host variable declaration, as shown here:

COBOL Host Variable Declaration DBMS International Encoding Specification Summary
PIC X UTF-16 Conversion of DBMS data to and from host variables using the locale1 of the client application.

Possible data loss if your UTF-16 data is not supported with the locale of your application.

PIC X UTF-8 No conversion or translation of data if the locale1 of the client application is also UTF-8.
Note: Application locale UTF-8 is not supported on Windows platforms.

Highly recommended.

Conversion of DBMS data to and from host variables using the locale1 of the client application does take place if UTF-8 is not the locale of the client application. This can lead to possible data loss.

PIC X MBCS2 No conversion or translation of data if the locale1 of the client application uses the same MBCS2.

Highly recommended.

Conversion of DBMS data to and from host variables using the locale of the client application does take place if the MBCS of the client application does not match that of the DBMS. This can lead to possible data loss.

PIC N USAGE DISPLAY-1 PIC G4 UTF-16, UTF-8 Conversion of data to and from host variables using the locale1 of the client application.

Data is converted the DBCS3 of the client application's locale. This can lead to possible data loss.

PIC N USAGE DISPLAY-1 PIC G4 MBCS2 Minor conversion or translation of data if the locale1 of the client application uses the same MBCS2. In this case, single-byte characters in the DBMS are converted to and from the DBCS3 of the client application's locale.

If the MBCS of the client application does not match that of the DBMS, this can lead to possible data loss.

PIC N USAGE NATIONAL UTF-16 No conversion or translation of data.

Highly recommended.

PIC N USAGE NATIONAL UTF-8, MBCS2 Conversion of DBMS data to and from host variables where the format is UTF-16.

Because data is converted between UTF-8 and MBCS to and from UTF-16 format in host variables, no loss of data can occur.

Recommended.

1Code page.

2Mixed- or Multi-byte Character Set. Used to support mixed character sets containing characters that can be represented with single bytes (SBCS) as well as double bytes (DBCS). MBCSs exist in Japan, China, and Korea. For example, MBCS 932 is for the Japanese language.

3Double-byte Character Set. DBCS is the double-byte character component of an MBCS.

4PIC N USAGE DISPLAY-1 and PIC G host variables in your COBOL program always uses the DBCS that corresponds to the locale of your client application.

Example 1

If you store MBCS or UTF-8 in your DBMS, it is best to set the locale of your client application to the same value, and use PIC X host variables in your COBOL program.

Example 2

If you store UTF-16 in your database, it is best to use PIC N USAGE NATIONAL host variables in your COBOL programs.