The Host code page is always changed to 37 when importing HCD file in Visual Studio
If you create a Host File Project in Visual Studio to utilize the Managed Data Provider for Host Files included with Host Integration Server 2006, you may notice an issue if you are trying to use a host code page other than code page 37 (EBCDIC – U.S./Canada).
After you add a Host File Library, you may want to import an existing Host Column Description (HCD) file that describes the format of the data files that you will be accessing on the host file system. The following is an excerpt from a sample HCD file:
[files]
SAMPLE/ACCOUNTS=1
[SAMPLE/ACCOUNTS]
numcol=4
col1=0;CUST_NO;CUST_NO;8;0;0;ZONED;LONG;N;937;;
col2=0;CUST_NAME;CUST_NAME;0;0;40;CHAR;CHAR;N;937;;
col3=0;BALANCE;BALANCE;10;2;0;ZONED;FLOAT;Y;937;;
col4=0;LAST_ACC;LAST_ACC;0;0;26;TIMESTAMP;TIMESTAMP;N;937;;
In this sample, the host code page is configured to be code page 937 (IBM EBCDIC – Traditional Chinese). When I import this HCD file into my Host File Library and view the results in the HCD tab in the Visual Studio designer, I see that the listed code page is shown as code page 37 as follows:
[Files]
SAMPLE/ACCOUNTS=1
[SAMPLE/ACCOUNTS]
UseForFileTransfer=0
DelimiterField=
DelimiterRecord=
TextQualifier=
FileCreationType=0
KeyPosition=0
KeyLength=0
KeySort=A
Col1=0;CUST_NO;CUST_NO;8;0;8;ZONED;LONG;N;37; ;N;
Col2=0;CUST_NAME;CUST_NAME;40;0;40;CHAR;CHAR;N;37; ;N;
Col3=0;BALANCE;BALANCE;8;2;10;ZONED;DECIMAL;N;37; ;N;
Col4=0;LAST_ACC;LAST_ACC;0;0;26;TIMESTAMP;TIMESTAMP;N;37; ;N;
The good news is that change of the host code page here doesn’t have any effect on the actual data conversion that will be done when reading/writing data from/to the host files. This is a benign bug in the designer for host file projects. The host code page configured in the connection string (or UDL file) is the one actually used for the data conversion.
The bad news is that there is a bug in HIS 2006 that causes the host code page configured in the connection string to be ignored. The result is that the Managed Data Provider for Host Files always uses host code page 37 for data conversions. This, of course, results in incorrect data conversions unless you actually need to use host code page 37.
A final piece of good news is that there is a hotfix for HIS 2006 that updates the Managed Data Provider for Host Files so that the host code page configured in the connection string is used for the data conversions. The hotfix DOES NOT correct the issue with the imported HCD in the Visual Studio designer always showing a host code page of 37. But again, the Visual Studio issue doesn’t affect the actual functionality of the Managed Data Provider for Host Files application.
If you need to obtain the HIS 2006 hotfix mentioned here, please contact Microsoft Product Support Services and request the Host Integration Server hotfix described in Knowledge Base article 961977. Please note that as of this posting KB Article 961977 is not yet published so you won’t find it on the https://support.microsoft.com site.
The issue with using the correct host code page from the connection string is also resolved in the recently released HIS 2009 product. HIS 2009 still has the Visual Studio designer issue with the imported HCD always showing host code page 37.