Previous Topic Next topic Print topic


REVERSE Function

Purpose

Returns a nonvarying string that contains the elements of an expression in reverse order.

Syntax

REVERSE(x)

Parameters

x should be a string type. It is converted to string if needed.

Description

REVERSE returns a nonvaying string that contains the elements of an expression x in reverse order. x must have a computational type and a string type. If it does not have a string type, it is converted to string (that is, from numeric to bit or character), according to the rules for concatenation.

Examples

dcl s char (40) varying;
  
    s = 'NeverOddOrEven';
    s = reverse(s);
    put skip list (s);

will print:

nevErOddOreveN

Restrictions

For structure expressions, only flat structures are allowed. Arrays, arrays of structures, and structure member arrays are not yet supported.

Previous Topic Next topic Print topic