CHARACTER returns the character value of x, with a length specified by y. CHARACTER also supports conversion from graphic to character type.
>>-CHARACTER(x-+----+-)---------------------------------------->< '-,y-'
Abbreviation: CHAR
x must have a computational type.
When x is nongraphic, CHARACTER returns x converted to character.
When x is GRAPHIC, CHARACTER returns x converted to SBCS characters. If a DBCS character cannot be translated to an SBCS equivalent, the CONVERSION condition is raised.
The values of x are not checked.
If y is omitted, the length is determined by the rules for type conversion.
y cannot be negative.
If y = 0, the result is the null character string.
dcl X graphic(6);
dcl A char (6);
A = char(X);
For X with value |
Intermediate result |
A is assigned |
---|---|---|
.A.B.C.D.E.F |
ABCDEF |
ABCDEF |