LEFT

LEFT returns a string that is the result of inserting string x at the left end of a string with length n and padded on the right with the character z as needed.

Read syntax diagramSkip visual syntax diagram
>>-LEFT(x,n-+----+-)-------------------------------------------><
            '-,z-'     

x
Expression. x must have a computational type and should have a character type. If not, it is converted to CHARACTER.
n
Expression. n must have a computational type and should have a character type. If n does not have the attributes FIXED BINARY(31,0), it is converted to them.
z
Expression. If specified, z must have the type CHARACTER(1) NONVARYING type.

Example

  dcl Source char value('One Hundred SCIDS Marks');
  dcl Target char(30);

  Target = left (Source, length(Target), '*');
             /* 'One Hundred SCIDS Marks*******'               */

If z is omitted, a blank is used as the padding character.






Published: 23 December 2018