GRAPHIC Function

Purpose

Can be use to explicitly convert character (or mixed character) data to GRAPHIC data. All other data first converts to character, and then to the GRAPHIC data type.

Returns the graphic value of x, with a length in graphic symbols specified by y.

Characters convert to graphics. The content of x is checked for validity during conversion, using the same rules as for checking graphic and mixed character constants.

Syntax

GRAPHIC(x[,y])

Parameters

x and y are expressions.

Description

When x is GRAPHIC it is subject to a length change, with appropriate padding or truncation. When x is nongraphic it is converted to character, if necessary. SBCS characters are converted to equivalent DBCS characters.

When necessary, y is converted to a real fixed-point binary value. If y is omitted, the length is determined by the rules for type conversion. y must not be negative.

If y = 0, the result is the null graphic string.

The following rules apply:

  • If y is greater than the length needed to contain the graphic string, the result is padded with graphic blanks.
  • If y is less than the length needed to contain the graphic string, the result is truncated.

Restrictions

None.