DISPLAY-OF

The DISPLAY-OF function returns an alphanumeric character string consisting of the content of argument-1 converted to a specific code page representation.

The type of the function is alphanumeric.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION DISPLAY-OF (argument-1 argument-2)
argument-1
Must be of class national (categories national, national-edited, and numeric-edited described with usage NATIONAL). argument-1 identifies the source string for the conversion.
argument-2
Must be an integer. argument-2 identifies the output code page for the conversion.

argument-2 must be a valid CCSID number and must identify an EBCDIC, ASCII, UTF-8, or EUC code page. An EBCDIC or ASCII code page can contain both single-byte and double-byte characters.

If argument-2 is omitted, the output code page is the one that was in effect for the CODEPAGE compiler option when the source code was compiled.

The returned value is an alphanumeric character string consisting of the characters of argument-1 converted to the output code page representation. When a source character cannot be converted to a character in the output code page, the source character is replaced with a substitution character. The following table shows substitution characters for some widely-used code pages:

Output code page Substitution character
SBCS ASCII
PC Windows SBCS
X'7F'
EBCDIC SBCS X'3F'
ASCII DBCS X'FCFC'
EBCDIC DBCS (except for Thai) X'FEFE'
EBCDIC DBCS (Thai) X'41B8'
PC DBCS (Japanese or Chinese) X'FCFC'
PC DBCS (Korean) X'BFFC'
EUC (Korean) X'AFFE'
EUC (Japanese) X'747E'
UTF-8

From SBCS: X'1A'
From MBCS: X'EFBFBD'
UTF-16

From SBCS: X'001A'
From MBCS: X'FFFD'

No exception condition is raised.

The length of the returned value depends on the content of argument-1 and the characteristics of the output code page.

Usage notes

  • The CCSID for UTF-8 is 1208.
  • If the output code page includes DBCS characters, the returned value can be a mixed SBCS and DBCS string.
  • The DISPLAY-OF function, with argument-2 specified, can be used to generate character data represented in a code page that differs from that specified in the CODEPAGE compiler option. Subsequent COBOL operations on that data can involve implicit conversions that assume the data is represented in the EBCDIC code page specified in the CODEPAGE compiler option. See Converting to or from national (Unicode) representation in the Enterprise COBOL Programming Guide for examples and programming techniques for processing data represented using more than one code page within a single program.

Exception: If the conversion fails, a severe runtime error occurs. Verify that the z/OS® Unicode conversion services are installed and are configured to include the table for converting from CCSID 1200 to the output code page. See the Customization Guide for installation requirements to support the conversion.