INFORMIX
Informix Guide to GLS Functionality
Chapter 7: General SQL API Features
Home Contents Index Master Index New Book

Non-ASCII Characters in ESQL Source Files

Each Informix SQL API product contains a processor to process an ESQL source file that has embedded SQL and preprocessor statements:

UNIX
    The name of the ESQL/COBOL processor is esqlcobol.

Windows

The processors for ESQL/C and ESQL/COBOL products use operating-system files in the following situations:

    The ESQL processors use the client code set (that the client locale specifies) to generate the filenames for these language-specific files.

    The ESQL processors use the client code set to interpret the contents of these ESQL source files.

You specify the client locale with the CLIENT_LOCALE environment variable. For more information on this environment variable, see page 2-6.

Generating Non-ASCII Filenames

When an ESQL processor processes an ESQL source file, it must generate a corresponding intermediate file for the source file. If you use non-ASCII characters (8-bit and multibyte character) in these source-file names, the following restrictions affect the ability of the ESQL/C or ESQL/COBOL processor to generate filenames that contain non-ASCII characters:

The GLS8BITFSYS Environment Variable

The GLS8BITFSYS environment variable on the client computer tells an ESQL processor whether the operating system is 8-bit clean. An ESQL processor uses the value of GLS8BITFSYS to determine whether it can use non-ASCII characters in the filename of an ESQL intermediate file that it generates, as follows:

For example, suppose you compile an ESQL/C source file that is called A1A2B1B2.ec, where A1A2 and B1B2 are multibyte characters. If GLS8BITFSYS is set to 1 (or is not set) on the client computer, an ESQL processor assumes that the operating system on the client computer is 8-bit clean, and it generates an intermediate C file that is called A1A2B1B2.c.

For more information on an 8-bit-clean operating system and on the GLS8BITFSYS environment variable, see page 2-23.

The Client Code Set

When an ESQL processor actually creates a file whose filename has non-ASCII characters, the client locale must support these non-ASCII characters. Before you start an Informix database server, you must ensure that the code set of the client locale (the client code set) contains these characters. When you use a nondefault locale, you must set the CLIENT_LOCALE environment variable to the name of a locale whose code set contains these non-ASCII characters.

For example, suppose you want to process an ESQL/C source file with the path /A1A2B1B2/C1C2D1D2, where A1A2, B1B2, C1C2, and D1D2 are multibyte characters in the Japanese SJIS code set. You must perform the following steps to enable the esql command to create the intermediate C source file on the client computer:

    1. Set the CLIENT_LOCALE environment variable on the client computer to the Japanese SJIS locale, ja_jp.sjis.

    2. Process the ESQL/C source file with the esql command.

Once an ESQL processor creates an intermediate file, it has generated a filename and written file contents in the client code set. Any Informix product or client application that needs to access this file must have a client locale that supports this same code set.

If the code sets that are associated with the filename and with the client locale do not match, a valid filename might contain illegal characters with respect to the client locale. The ESQL processor rejects any filename that contains illegal characters and displays the following error message:

Using Non-ASCII Characters in Source Code

The ESQL processors obtain the code set for use in ESQL source files from the client locale. Within an ESQL source file, you can use non-ASCII characters for the following objects (these examples use A1A2 and B1B2 to represent multibyte characters):

    For example, in an ESQL/C program, the following use of multibyte characters is valid:

char A1A2[20], B1B2[20];

.
.
.

EXEC SQL select col1, col2 into :A1A2 :B1B2;

    For example, in an ESQL/COBOL program, the following use of multibyte characters is valid:

EXEC SQL CONNECT TO A1A2 END-EXEC. -- A1A2 DATABASE OPENED

    For example, in an ESQL/C program, the following use of multibyte characters is valid:

EXEC SQL insert into tbl1 (nchr1) values 'A1A2B1B2';

    For example, in an ESQL/COBOL program, the following use of multibyte characters is valid:

EXEC SQL INCLUDE 'A1A2/B1B2' END-EXEC.

Tip: Some C-language compilers support multibyte characters in literals or comments only. For such compilers, you might need to set the ESQLMF and CC8BITLEVEL environment variables so that the ESQL/C processor calls a multibyte filter. For more information, see "The esqlmf Filter".
To use non-ASCII characters in your ESQL source file, the client locale must support them.




Informix Guide to GLS Functionality, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.