Graphic strings
A graphic string is a sequence of double-byte characters.
The length of the string is the number of characters in the sequence. Like character strings, graphic strings can be empty. An empty string should not be confused with the null value.
Fixed-length graphic strings
When fixed-length graphic string distinct types, columns, and variables are defined, the length attribute is specified and all values have the same length. For a fixed-length graphic string, the length attribute must be in the range 1–127 inclusive. A fixed-length graphic string column can also be called a GRAPHIC column.
Varying-length graphic strings
The types of varying-length graphic strings are VARGRAPHIC and double-byte character large object (DBCLOB). DBCLOB is a type of LOB. A DBCLOB column is useful for storing large amounts of double-byte character data, such as documents written with a single double-byte character set.
When varying-length graphic strings, distinct types, columns, and variables are defined, the maximum length is specified and this length becomes the length attribute. Actual values might have a smaller value. For a varying-length graphic string, the length attribute must in the range 1–16352.
For a varying-length graphic string column, the maximum for the length attribute is determined by the record size associated with the table, as described Maximum record size in the description of the CREATE TABLE statement. For a DBCLOB string, the length attribute must be in the range 1–1 073 741 823 inclusive. In UTF-16, although supplementary characters use two 2-byte code points, supplementary characters are still considered double-byte characters. For more information about DBCLOBs, see Large objects (LOBs).
Graphic string variables
Variables with a graphic string type cannot be defined in Fortran. Also, graphic string variables must follow these rules:
- Fixed-length graphic string host variables can be defined in all host languages, except REXX and Java™. In C, fixed-length graphic-string variables are limited to a length of 1.
- Varying-length graphic string variables can be defined in all host languages, with the exception of DBCLOBs which cannot be used in REXX.
Graphic string encoding schemes
Each graphic string can be further defined as either double-byte data or Unicode data.
- Double-byte data
- Data in which every character is represented by a character from the double-byte character set (DBCS) that does not include shift-out or shift-in characters. Each double-byte graphic string has an associated ASCII or EBCDIC CCSID.
- Unicode data
- Data that contains characters represented by two bytes, except supplementary characters, which take two 2-byte code points per character. Each Unicode graphic string is encoded using UTF-16. The CCSID for UTF-16 is 1200.
String units in built-in functions
When working with graphic strings, you can specify the string unit in which the operation is to take place for certain built-in functions and the CAST specification. The string unit determines the length in which the operation is to occur.
For more information about string units, see String unit specifications.