LEFT Function

Purpose

Returns the result of inserting a string to the left of another string with a certain length. It can be padded on the right with a character.

Syntax

LEFT(s,l,c)

Parameters

s
A string that is inserted to the left 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 left of which s is inserted. It must have a computational type and a character type and is converted to Fixed Binary(31,0).
c
Optional padding character, inserted to the right of the string. It must have a nonvarying character type.

Description

LEFT returns a string which is formed by inserting a string s to the left of another string with length l. An optional padding character c can be attached to the right.

Examples

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

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

will print:

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

Restrictions

None.