Purpose
Converts an arithmetic or string value to a character string.
Syntax
CHARACTER(s)
or
CHARACTER(s, l)
Abbreviation(s): CHAR for
CHARACTER.
Parameters
s is an arithmetic or string value, and
l is a positive integer value.
Examples
DECLARE X FIXED BINARY (15);
DECLARE Y CHARACTER(14) VARYING;
X = 2;
Y = CHARACTER(X);
PUT LIST ('$'||Y); /* $ 2 */
Restrictions
The CHARACTER function does not support unaligned BIT(n) parameters.
Description
The CHARACTER function converts an arithmetic or string value s to a character string of an optionally specified length l. s is first converted to a character string whose length is determined by the rules for data type conversion given in the chapter Data Type Conversions. Then, if l is given, s is either truncated on the right or extended on the right with blanks to be l characters long.