MAXLENGTH Function

Purpose

Returns the maximum length of a string. The result precision is Fixed Binary(15).

Syntax

MAXLENGTH(x)

Parameters

x is an expression that must have a computational type and should have a string type. Otherwise, it is converted to character.

Examples

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

    s = 'The Lawn, 22-30 Old Bath Road';

    put skip list ('maxlength(s) is: ', maxlength(s));   /* char var */
    put skip list ('maxlength(t) is: ', maxlength(t));   /* char       */

will print:

maxlength(s) is:               40
maxlength(t) is:               40

Restrictions

None.