If you are using DB2 Control Center on Windows and wondering how to set the code page of your choice, follow these steps.

Open a DB2 command window:

C:\>SET DB2CODEPAGE=1208
C:\>db2cc

The first command sets the environment variable DB2CODEPAGE to 1208 (UTF-8) and second command launches Control Center.

How would you know if the Control Center picked up the chosen code page or not?

In Control Center click Tools>Tools Settings and click on Command Editor tab. Check Display SQLCA Data and close the Tools settings window.

Now, right click on Database in CC and select “Query”. This will open up DB2 Command Editor GUI window. Type any command and you will see the SQLCA data and this holds the key.

SQLCA Information
 sqlcaid : SQLCA    sqlcabc: 136 sqlcode: 0 sqlerrml: 70
 sqlerrmc: 1 1208 VIKRAM   SAMPLE QDB2/NT 86 86 0 1208 1                         
 sqlerrp : SQLRI01F
 sqlerrd : [1]: -2147221503 [2]: 1 [3]: 0
           [4]: 0 [5]: 0 [6]: 0
 sqlwarn : [1]:   [2]:   [3]:   [4]:   [5]:   [6]:  
           [7]:   [8]:   [9]:   [10]:   [11]:  

The sqlerrmc shows the 1208 codepage of the database and second codepage after SAMPLE is also shown as 1208 which was picked up through the DB2CODEPAGE setting. You would have seen 1252 as code page if you had not used DB2CODEPAGE environment variable.

Why do we have to go through the above trouble? Just to see the data properly displayed in the GUI window.