Work with LONGCHAR data
- Last Updated: February 2, 2026
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
A LONGCHAR variable consists of CHARACTER data, but unlike the CHARACTER type, this type is not limited to 32K in size. A LONGCHAR variable can be larger, but it may be limited by available memory. You can use many of the ABL character handling capabilities with LONGCHAR strings. The LONGCHAR data type has metadata associated with it to designate its code page and other information. The default initial value of a LONGCHAR variable is the empty string ("").
ABL has another data type known as a character large object (CLOB). A CLOB field is a database table or temp-table field that contains a locater, which points to the associated CLOB data stored in the database. You cannot manipulate CLOB data directly. Instead, you must copy a CLOB to a LONGCHAR to manipulate the character contents of a CLOB field in ABL. You can do this with the COPY-LOB statement.
Like CLOB values, LONGCHAR values can be in any code page supported by the OpenEdge convmap.p file, and the code page information is retained by the LONGCHAR. ABL ensures that all characters are valid with respect to the code page of the LONGCHAR.
Display a LONGCHAR
STRING function to convert it to a CHARACTER value. The following
example code demonstrates these ways:
|
You can display a portion of a LONGCHAR variable using the SUBSTRING function, but you must still
assign the LONGCHAR variable to a CHARACTER variable. Because the input to the
SUBSTRING function is a LONGCHAR, its return
value is also a LONGCHAR, and you cannot directly display a LONGCHAR. The following
example code shows how to display a portion of a LONGCHAR variable.
|
VIEW-AS EDITOR LARGE option. The following example code shows how to
display a LONGCHAR using this option. Note that you must set the number of lines and
the line width, in characters. The string in the following example code does not
exceed 32K, but is used for illustration purposes only.
|