STRING Function

Purpose

Concatenates the elements of an array or a structure and returns the results.

Syntax

STRING(s)

Parameters

s is an arithmetic value, string value, picture value, or an array or structure containing all string or picture values.

Description

The STRING function concatenates the elements of an array s or a structure s and returns the results. If s is scalar, it is converted to a string.

If s is an array or structure, it must:
  • have connected storage
  • not be union or structure containing unions
  • must be comprised of all type bit, or all of type char, char varying, and/or picture.

The result is converted to a string according to the rules for data type conversion given in the chapter Data Type Conversions.

For a description of the STRING function's use as a pseudovariable, see the section Assignment in the chapter Statements.

Examples

DECLARE S(4) CHAR(1);
S(1) = 'A';
S(2) = 'B';
S(3) = 'C';
S(4) = 'D';

STR = STRING(S);   /* 'ABCD' */

Restrictions

  • Structure arrrays containing char varying data items when applied as the argument to the STRING built-in is not yet supported.
  • Structures containing a mix of arrays and char varying data items when applied as the argument to the STRING pseudo-variable is not yet supported.