ENCODING bind option
The ENCODING option specifies the application encoding for all host variables in static statements in a plan or package.
Command option | Option values | Used with |
---|---|---|
ENCODING |
|
- Values other than
ENCODING(UNICODE)
are not valid for BIND SERVICE commands. - The ENCODING bind option is not valid for REBIND of packages for native SQL procedures, native REST services, or advanced triggers.
Option descriptions for ENCODING
- ENCODING(ASCII)
- ASCII encoding is used. The American Standard Code for Information Interchange (ASCII) is an encoding scheme. ASCII is typically used on Intel-based systems, such as Windows, and UNIX-based systems, such as Linux®. For more information, see ASCII.
- ENCODING(EBCDIC)
The encoding specified by the SYSTEM EBCDIC CCSID field value is used. See EBCDIC CCSID field (SCCSID, MCCSID, and GCCSID DECP values). Extended Binary Coded Decimal Interchange Code (EBCDIC) is an encoding scheme that is typically used on IBM® zSystems™ (z/OS®) and iSeries (System i). For more information, see EBCDIC.
- ENDODING(UNICODE)
- Unicode encoding is used. Unicode is an encoding scheme that currently provides a unique code point for over 100,000 characters. This standard enables systems to more easily handle global data, regardless of the platform, program, or language. For more information, see Unicode.
- ENCODING(ccsid)
- A value other than the SYSTEM EBCDIC CCSID. You might select this option when a data source, such as a terminal emulator, uses a CCSID that is not the same as the SYSTEM EBCDIC CCSID. For example, a user has a terminal emulator with a CCSID of 1047, but the SYSTEM EBCDIC CCSID is 37. In this case, the plan or package being used by that user should be bound with ENCODING (1047). For more information, see System-coded character set identifiers (CCSIDs).
You can specify ASCII, UNICODE, or ccsid, where ccsid is a value other than the SYSTEM EBCDIC CCSID, for any plan or package precompiled on DB2® version 7 or later.
EBCDIC is the only valid option for a plan or package that was precompiled in DB2 version 6 or earlier. If you specify ccsid on any such plan or package, the value of ccsid must match the SYSTEM EBCDIC CCSID field value. See EBCDIC CCSID field (SCCSID, MCCSID, and GCCSID DECP values).
ENCODING also affects the content of the data that is returned by the SQL statement DESCRIBE. Db2 will return column names, label names, or both (if requested) in the specified application encoding scheme.
Default values for ENCODING
The default package application encoding scheme is not inherited from the plan application encoding option. The default for a package that is bound on a remote Db2 for z/OS system is the remote server's default application encoding scheme. Similarly, when a plan or package is run on a remote Db2 for z/OS server, the specified ENCODING option is ignored. Instead, the remote server's encoding scheme is used.
The following statements set the value of the host variable and do not require the package to be bound into the plan:
SET CURRENT PACKAGE SET = :HV ,
SET :HV = CURRENT PACKAGE SET ,
SET :HV = CURRENT PACKAGE PATH ,
SET CURRENT PACKAGE PATH = :HV
The host variable uses the system default application encoding scheme, even when the application is bound with the ENCODING (EBCDIC/UNICODE) bind option.
Process | Default value |
---|---|
BIND PLAN | The system default application encoding scheme that was specified at installation time |
BIND PACKAGE | The system default application encoding scheme that was specified at installation time |
BIND SERVICE | UNICODE |
REBIND PLAN | Existing value |
REBIND PACKAGE | Existing value |
Catalog records for ENCODING
See the ENCODING_CCSID column in SYSPLAN catalog table or SYSPACKAGE catalog table.
The value is set as follows:
- For a MIXED=NO subsystem, if ENCODING(ASCII) or ENCODING(EBCDIC) is specified, the SBCS CCSID of the encoding scheme is stored in the catalog.
- For a MIXED=YES subsystem, if ENCODING(ASCII) or ENCODING(EBCDIC) is specified, the mixed CCSID of the encoding scheme is stored in the catalog.
- If ENCODING(UNICODE) is specified, the mixed CCSID (1208) is stored in the catalog, regardless of the MIXED setting.