RIGHT Function

Purpose

Returns the result of inserting a string at the right of another string with a certain length. It can be padded on the left with a character. If no padding character is inserted, a blank is used as a padding.

Syntax

RIGHT(s,l,c)

Parameters

s
A string that is inserted to the right of another sting. It must have a computational type and a character type. If it does not have a character type, it is converted to character.
l
The length of a string to the rigth of which s is inserted. It must have a computational type and is converted to Fixed Binary(31,0).
c
Optional padding character, inserted to the left of the string. It must have a nonvarying character type.

Description

RIGHT returns a string which is formed by inserting a string s to the right of another string with length l. An optional padding character c can be attached to the left. If not, a blank is used as a padding.

Examples

dcl s char (40) var;
    dcl t char (40) var;

    s = 'This string is 33 characters long';
    t = right(s, 40, '+');
    put skip list (t);

will print:

+++++++This string is 33 characters long

Restrictions

None.