The SUBSTR function returns a substring (from a string specified
as a parameter) that is of the specified starting point and
length. The return value is compatible with all other string
types.
Syntax:
SUBSTR( str,start [,length] )
The parameter 'str' is a character string value; the parameter
'start' is an integer value that indicates the starting position
of the substring. The parameter 'length' is an integer value
that indicates the length of the substring. If the 'length'
argument is omitted, the length is computed to be the remainder
of the string value beginning at the starting position. The
'length' argument cannot be omitted on OpenVMS VAX systems. For
example,
SUBSTR(string,start_index)
is identical to
SUBSTR(string,start_index,length(string)-string_index+1)
When you use the SUBSTR function, the value of the starting
position must be greater than 0, the value of the length must be
greater than or equal to 0, and there must be enough characters
following the starting position to construct a substring of the
specified length.