EBCDIC and code pages
Why 3270 and 5250 hosts use EBCDIC, what a code page is, and how to fix wrong symbols.
IBM mainframes and IBM i store text in EBCDIC, not ASCII. The same letter has a different byte value. A terminal translates between EBCDIC and the characters you see using a code page.
Letters and digits are the same everywhere
For the common Latin code pages these byte ranges match, so most text looks right even with the wrong code page:
A to I C1 to C9 a to i 81 to 89
J to R D1 to D9 j to r 91 to 99
S to Z E2 to E9 s to z A2 to A9
0 to 9 F0 to F9 space 40
Punctuation is where code pages differ
The characters that move between code pages are mostly symbols. Brackets, braces, the backslash, |, ^, !, ~ and the currency signs are the usual suspects. For example, [ is byte BA in code page 037 but AD in code page 1047, so a screen written for one and shown with the other has the wrong symbol in the wrong place. Db2 SPUFI checks for this and warns with DSNE345I; see DSNE345I in SPUFI: terminal CCSID is not the same as the SPUFI CCSID.
The full list of national code pages and the euro variants is in EBCDIC code page list.
Picking one
- 037 is the usual US and Canada default.
- 500 is "international".
- 1047 is the Latin-1 page used by z/OS UNIX System Services and many open-systems tools.
- 1140 is 037 with the euro sign. Other national pages have a euro twin (see the list).
- If your site uses a national page, for example 273 for German or 285 for UK English, use that one.
The host administrator can tell you which code page the host expects. For TN3270E and TN5250 hosts it may be set by the terminal type or by the connection settings.
Symptoms of the wrong page
- A pound sign, brackets or
|show as other symbols, or typing[makes the host report a bad character. - Accented characters turn into the wrong letters.
- Everything looks fine until you use a symbol. That points to the code page, not to the connection.
CCSID
IBM numbers its code pages with CCSIDs (coded character set identifiers). Code page 037 has CCSID 37. On IBM i the CCSID of a job, a user profile and a file decides how data is converted. CCSID 65535 means "do not convert".