Invoke the ESQL/C filter

The esql command can automatically call the filter, esqlmf, to process non-ASCII characters.

The following figure shows how the program that contains non-ASCII characters becomes an executable program.
Figure 1: Create an ESQL/C executable program from a non-ASCII source program

The figure shows how the program that contains non-ASCII characters becomes an executable program.
When you set the following environment variables, you tell esql how to invoke esqlmf:
  • The ESQLMF environment variable indicates whether esql automatically calls the filter.

    When you set ESQLMF to 1, esql automatically calls esqlmf after the preprocessor and before the C compiler.

  • The CC8BITLEVEL environment variable indicates the non-ASCII characters in the source file that esqlmf filters.

    Set CC8BITLEVEL to indicate the ability of your C compiler to process non-ASCII characters.

How esqlmf filters the source file depends on the value of the CC8BITLEVEL environment variable. For each value of CC8BITLEVEL, the following table shows the esqlmf command that the processor invokes on the source file.
CC8BITLEVEL The esqlmf action
0 Converts all non-ASCII characters, in literal strings and comments, to octal constants.
1 Converts non-ASCII characters in literal strings, but not in comments, to octal constants.
2 Converts non-ASCII characters in literal strings to octal constants to ensure that all the bytes in the non-ASCII characters have the eighth bit set.
3 Does not invoke esqlmf.
Important: To start the esqlmf commands that CC8BITLEVEL can specify, you must set the ESQLMF environment variable to 1.
When you set CC8BITLEVEL to 0, 1, or 2, the processor performs the following steps:
  1. Converts the embedded-language statements (source.ec) to C-language source code (source.c) with the preprocessor
  2. Filters non-ASCII characters in the preprocessed file (source.c) with the filter, esqlmf (if the ESQLMF environment variable is 1)

    Before esqlmf begins filtering, it creates a copy of the C source file (source.c) that has the .c_ file extension (source.c_).

  3. Compiles the filtered C source file (source.c) with the C compiler to create an object file (source.o)
  4. Links the object file with the libraries and your own libraries to create an executable program

When you set CC8BITLEVEL to 3, the processor omits step 2 in the preceding list.

If you do not set CC8BITLEVEL, then esql converts non-ASCII characters in literal strings and comments. You can modify the value of CC8BITLEVEL to reflect the capabilities of your C compiler.