SET CURRENT APPLICATION ENCODING SCHEME

The SET CURRENT APPLICATION ENCODING SCHEME statement assigns a value to the CURRENT APPLICATION ENCODING SCHEME special register. This special register allows users to control which encoding scheme will be used for dynamic SQL statements after the SET statement has been executed.

Invocation

This statement can be embedded only in an application program. It is an executable statement that cannot be dynamically prepared.

Authorization

None required.

Syntax

                .-APPLICATION-.                   .-=-.   
>>-SET CURRENT--+-------------+--ENCODING SCHEME--+---+--------->

>--+-string-constant-+-----------------------------------------><
   '-host-variable---'   

Description

string-constant
A character string constant that represents a valid encoding scheme (ASCII, EBCDIC, UNICODE, or a character representation of a number between 1 and 65533).
host variable
A variable with a data type of CHAR or VARCHAR. The value of host-variable must not be null and must represent a valid encoding scheme or a character representation of a number between 1 and 65533). An associated indicator variable must not be provided.

The value must:

  • Be left justified within the host variable
  • Be padded on the right with blanks if its length is less than that of the host variable

Examples

The following examples set the CURRENT APPLICATION ENCODING SCHEME special register to 'EBCDIC' (in the second example, Host variable HV1 = 'EBCDIC').
  EXEC SQL SET CURRENT APPLICATION ENCODING SCHEME = 'EBCDIC';
  EXEC SQL SET CURRENT ENCODING SCHEME  = :HV1;