Try OpenEdge Now
skip to main content
ABL Data Types Addenda
Large object data types : Character large objects : CLOB code pages
 

CLOB code pages

There are two types of CLOB values:
*DBCODEPAGE (for database tables) or TTCODEPAGE (for temp-tables) — A DBCODEPAGE CLOB is a field in a database that is in the database's codepage and uses the collation table associated with the database's codepage. A TTCODEPAGE is a CLOB field in a temp-table that is in the code page set by the Internal Code Page (-cpinternal) startup parameter. Also, if you define a temp-table field to be LIKE a DBCODEPAGE database field, the -cpinternal code page is used for the temp-table field.
*COLUMN-CODEPAGE — When you define a CLOB field (either in a database or a temp-table) you can use COLUMN-CODEPAGE to specify the code page of the CLOB as well as a valid collation for that code page.
If you do not specify a code page for a CLOB field in a temporary table, the default code page is -cpinternal. In the following example, clopcp and clopdb are CLOB fields defined elsewhere. The clopcp field is a COLUMN-CODEPAGE type of CLOB with code page 1252. The clopdb field is a DBCODEPAGE type of CLOB with code page UTF-8. The code page set by -cpinternal is iso8859-1:
DEFINE TEMP-TABLE ttab
   FIELD ttab1 AS CLOB
   FIELD ttab2 AS CLOB COLUMN-CODEPAGE "UTF-16"
   FIELD ttab3 LIKE clobcp
   FIELD ttab4 LIKE clobdb
   FIELD ttab5 LIKE clobcp TTCODEPAGE.
In this example, ttab1 is in -cpinternal (iso8859-1) because that is the default code page for CLOB fields in a temp-table. The code page for ttab2 is UTF-16 because it is specifically set using the COLUMN-CODEPAGE option. The ttab3 field has the 1252 code page because it is defined as being LIKE clobcp which defines the code page of that CLOB as 1252.
The ttab4 field has the -cpinternal code page (iso8859-1) since it is defined LIKE clobdb which is a DBCODEPAGE CLOB. It is therefore converted to the code page of the temp-table, which is always defined by -cpinternal. (You can use the DBCODEPAGE function to get the name of a connected database's code page. For more information about the DBCODEPAGE function, see OpenEdge Development: ABL Reference.)
The ttab5 field is in TTCODEPAGE (-cpinternal). It is defined to be LIKE clobcp but the TTCODEPAGE keyword is specified and that overrides the code page of clobcp.