Substrings

A string variable can be subscripted to reference any part of the string. A substring has a starting position and a length. These subscripts are enclosed in parentheses.

You can use one or two subscripts to specify a substring. The first subscript is one-based and determines the first character position of the substring. The second subscript determines the length of the substring. If you do not specify a second subscript, PRO/5 assumes that the length of the substring is the remainder of the string.

The following rules apply to substrings:

Some examples of substrings:

A$(1,5)
NAME$(10)
XYZ$[3,4](1,5)

In the last example notice the combination of array subscripts and substring specification.