WIDECHAR Function

Purpose

Converts an arithmetic or string value to a wide character string.

Syntax

WIDECHAR(s)

or

WIDECHAR(s, l)
Abbreviation(s): WCHAR for WIDECHAR

Parameters

s is an arithmetic or string value, and l is a positive integer value.

Description

The WIDECHAR function converts an arithmetic or string value s to a wide character string of an optionally specified length l. s is first converted to a wide character string whose length is determined by the rules for data type conversion given in the Data Type Conversions chapter. Then, if i is given, s is either truncated on the right or extended on the right with blanks to be i characters long.

Examples

DECLARE X FIXED BINARY (15);
DECLARE Y WIDECHAR (14) VARYING;
X = 2;
Y = WIDECHAR(X);
PUT SKIP LIST (HEXIMAGE(ADDRDATA(Y), LENGTH(Y)*2)); /* 002000200020002000200020002000200032 */

Restrictions

  • The WIDECHAR function does not support unaligned BIT(n) parameters.
  • The WIDECHAR data type is not supported when using the -ebcdic compiler option.