IBM Support

CCSID 65535 Data is Not Converted to Character with .Net data provider

Troubleshooting


Problem

This document lists various methods that applications can use to force CCSID 65535 data character conversion when you use the IBM i Access Client Solutions - Windows Application Package .Net data provider (IBM.Data.DB2.iSeries).

Resolving The Problem

Forcing conversion with the .NET provider

The IBM DB2 for i .NET Provider (IBM.Data.DB2.iSeries) treats IBM DB2 for i character data with CCSID 65535 as binary. CCSID 65535 implies that the data is in an unknown CCSID, and therefore, it cannot be converted. The data is returned as an array of Byte (System.Byte[]) with no character conversion performed. However, the .NET provider does provide a mechanism to allow this data to be treated as character. This feature is enabled by using the following provider settings:

CharBitDataAsString - A Boolean value used to indicate whether parameters, result data, and schema information for iDB2CharBitData and iDB2VarCharBitData objects are treated as String values or as Byte array values. Some applications need to be able to retrieve these data types as translated character data. Setting this property to True allows the application to retrieve the data as translated character strings instead of as an array of bytes. The default value is false.

CharBitDataCcsid - An Int32 value used to indicate which CCSID is used to translate iDB2CharBitData and iDB2VarCharBitData types when the CharBitDataAsString property is set to True. This property is ignored when CharBitDataAsString is set to False. The default value is -1, and indicates that the host server job CCSID is used for translation.

Sample C# code that would enable the provider to convert data in CCSID 65535 as though it is CCSID 500 data would look as follows:
iDB2ProviderSettings.CharBitDataAsString = true;
iDB2ProviderSettings.CharBitDataCcsid = 500;
More information and examples can be found in the ".NET Provider Technical Reference", which is located within the IBM i Access Client Solutions Windows program menu.

Related Information

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"Data Access","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Historical Number

332628351

Document Information

Modified date:
22 June 2021

UID

nas8N1016164