9 205 REVERSE

LANSA Technical

9.205 REVERSE

Þ Note: Built-In Function Rules.

Reverses a text string.

Important note for DBCS: This Built-In function is DBCS unaware. To reverse a string containg DBCS characters so that the DBCS characters do not get corrupted you must use RDMLX  .Reverse instrinsic

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

YES

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

String to reverse

1

Unlimited

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Reversed string

1

Unlimited

 

 

 

 

Examples

Example 1: Reverse a text string input from user

DEFINE     FIELD(#INTEXT)  TYPE(*CHAR) LENGTH(20)
DEFINE     FIELD(#OUTEXT)  TYPE(*CHAR) LENGTH(20)
**********
REQUEST    FIELDS(#INTEXT)
USE        BUILTIN(REVERSE) WITH_ARGS(#INTEXT) TO_GET(#OUTEXT)
DISPLAY    FIELDS(#OUTEXT)
 

Example 2: Reverse a known text string

DEFINE     FIELDS(#OUTEXT)  TYPE(*CHAR) LENGTH(10)
**********
USE        BUILTIN(REVERSE) WITH_ARGS('''ti esreveR''') 
           TO_GET(#OUTEXT)
DISPLAY    FIELDS(#OUTEXT)