Creating a Custom Code Page

You can create a custom code page for 3270 and 5250 models by modifying any of the sample code page files provided with Host Integrator. By default, these examples are located in <VHI folder>\codepage folder for the Design Tool.

The basic steps for creating and implementing a custom code page are:

  1. Create a text file that includes the customization. The easiest way to create this file is to open an appropriate code page sample and make a modification.
  2. Save the modified file as custom.codepage in the same folder as the code page samples for the Design Tool. For a server version, add custom.code page in a codepage directory beneath the server directory.
  3. After saving custom.codepage, restart the Host Integrator server or Design Tool.

Editing a Code Page

A code page is a text file that includes character mappings or property values that differ from the default set (US English).
The property values at the top include the character set ID, the IBM code page, and, in the case of a 5250 model, the keyboard type. Additional information for specifying the Windows font when displaying international characters in the Design Tool can be included. The CanadianFrench.codepage.sample is used in the example below.
// VHI Custom 3270/5250 character translation table sample file.
// IBM EBCDIC codepage (CanadianFrench)
// Note: To enable this national character set for 3270 and 5250 sessions,
// copy and rename this file to "custom.codepage"
// Copyright...... Copyright (c) 2000-2007 Attachmate Corporation.
// All Rights Reserved.
IBMCCSID=697 // IBM Character set ID
IBMCodePage=37 // IBM codepage
IBMAS400Keyboard=CAI // AS/400 Keyboard type
WindowsFontCharSet=0 // (ANSI)

If, for example, you want to create a custom code page that has Canadian French settings except for the keyboard type, you could change the keyboard type from CAI to USB and then save it as custom.codepage.

IBMAS400Keyboard=USB // AS/400 Keyboard type (custom)

The lower portion of the code page sample is a series of character mappings. A character mapping consists of 3 values on a single line, separated by spaces or commas:

In the samples, mappings that are the same as the US English default are commented out with // at the beginning of the line. For example, the French.codepage.sample has H44 mapped to W '@' and U '@' for the 'commercial at' sign and is not commented out. (In US English, H44 is mapped to lowercase a with a grave accent sign.) You could create a custom code page based on the French code page, with a modification that returns H44 to the US English default.

Using the Custom Code Page Log File

After creating and saving the code page and then restarting the Host Integrator server or Design Tool, look at the log file for the code page: <Host Integrator install folder>\codepage\codepage.log.

When the code page is deployed successfully, the log looks like this:

    Custom codepage logfile opened: Thu Jun 22 08:17:18 2006
   Info	Duplicate character mapping: We8 ==> U0e48
   Info	Duplicate character mapping: We9 ==> U0e49
   Info	Duplicate character mapping: Wea ==> U0e4a
   Info	Duplicate character mapping: Web ==> U0e4b
   Info	Duplicate character mapping: Wec ==> U0e4c
   Info	=== Read 221 Lines of text
   Info	=== Found 99 host character mappings
   Info	+Added Mapping:	H41 <==> Wa0
   Info	=== Found 94 unicode character mappings
   Info	+Added Mapping:	: W1d <==> U00a2
   Info	+Added Mapping:	: W1e <==> U00a6
    Custom codepage logfile closed: Thu Jun 22 08:17:18 2006

When a code page has errors, the log file includes warnings such as the ones shown below:

Warn	Line 11	Unrecognized property 'MyProperty'
Warn	Line 20	!Host value invalid or out-of-range.
   Warn	Line 20	!Windows value invalid or out-of-range
   Warn	Line 20	!Unicode value invalid or out-of-range.
   Warn	Line 20	!Character mapping ignored "H3F    U10000"
Warn	Line 22	!Host value invalid or out-of-range.
   Warn	Line 22	!Windows value invalid or out-of-range
   Warn	Line 22	!Unicode value invalid or out-of-range.
   Warn	Line 22	!Character mapping ignored "HH    WW UU"