A character-string constant specifies a varying-length character
string.
The two forms of character-string constant follow:
- A sequence of characters that starts and ends with a string delimiter.
The number of bytes between the string delimiters cannot be greater than 32740.
Two consecutive string delimiters are used to represent one string delimiter
within the character string. Two consecutive string delimiters that are not
contained within a string represent the empty string.
- An X followed by a sequence of characters that starts and ends with a
string delimiter. The characters between the string delimiters must be an
even number of hexadecimal digits. Blanks between the string delimiters are
ignored. The number of hexadecimal digits must not exceed 32762. A hexadecimal
digit is a digit or any of the letters A through F (uppercase or lowercase).
Under the conventions of hexadecimal notation, each pair of hexadecimal digits
represents a character. This form of string constant allows you to specify
characters that do not have a keyboard representation.
Character-string constants can contain mixed data. If the job
CCSID supports mixed data, a character-string constant is classified as mixed
data if it includes a DBCS substring. In all other cases, a character-string
constant is classified as SBCS data.
The CCSID assigned to the constant is the CCSID of the source
containing the constant unless the source is encoded in a foreign encoding
scheme (such as ASCII). The data in the variable is converted from the foreign
encoding scheme to the default CCSID of the current server. In this case,
the CCSID assigned to the constant is the default CCSID of the current server.
The CCSID of the source is determined by the application requester.
The CCSID of the source is:
- For STRSQL, the default CCSID of the application requester
- For the RUNSQLSTM or STRREXPRC commands, the CCSID of the specified source
file
- For CRTSQLxxx:
- For static SQL, the CCSID of the source is the CCSID of the source file
used on the CRTSQLxxx command.
- For dynamic SQL, the CCSID of the source is the CCSID of the variable
specified on the PREPARE statement, or if a string constant is specified on
the PREPARE statement, the default CCSID of the current server.
Examples
'Peggy' '14.12.1990' '32' 'DON''T CHANGE' '' X'FFFF'