GRAPHIC explicitly converts character (or mixed character) data to GRAPHIC data. All other data first converts to character, and then to the GRAPHIC data type.
GRAPHIC returns the graphic value of x, with a length in graphic symbols specified by y.
The content of x is checked for validity during conversion, using the same rules as for checking graphic and mixed character constants.
>>-GRAPHIC(x-+----+-)------------------------------------------>< '-,y-'
y must not be negative.
If y = 0, the result is the null graphic string.
This example shows a conversion from CHARACTER to GRAPHIC. The target is long enough to contain the result.
dcl X char (11) varying;
dcl A graphic (11);
A = graphic(X,8);
For X with values | Intermediate result | A is assigned |
---|---|---|
|
|
|
where .b is a DBCS blank.
This example shows a conversion from CHARACTER to GRAPHIC. However, the target is too short to contain the result.
dcl X char (10) varying;
dcl A graphic (8);
A = graphic(X);
For X with value | Intermediate result | A is assigned |
---|---|---|
|
|
|