RIGHT

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

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

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

x
Expression. x must have a computational type and can have a character type. If not, it is converted to character.
n
Expression. n must have a computational type and is converted to FIXED BINARY(31,0).
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 = right (Source, length(Target), '*');
             /* '*******One Hundred SCIDS Marks'               */





Published: 23 December 2018