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:
Neither subscript can be negative.
The length of a substring can be zero.
The referenced substring must exist.
If a string is N bytes long, the first subscript can be N+1 only if the length given is zero.
If both subscripts are present and both are zero, PRO/5 returns a null string. For example, A$(0,0) is null. This is the only case in which the first subscript can be zero.
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.