Errors in substringing

It is important that you specify substrings carefully. The syntax can become complicated, and it is very easy to make mistakes. When the system finds an error in substring notation, it tries to assign a value whenever possible. For example, when a substring length of zero is specified, the system assigns a length of one.

Table 1 summarizes the errors that might occur in substring syntax. Always, assume that the dynamic system symbol &YR8. is assigned the substitution text 2008.

Table 1. Summary of errors in substring syntax
System Symbol Description of Error System Action Resulting Substring
&YR8(-5:1) The start position is not valid (it exceeds the length of the substitution text). The system assigns start position one. 2
&YR8(0:1) The start position is zero. The system assigns start position one. 2
&YR8(4:0) The length is zero. The system assigns a length of one. 8
&YR8(5:1) The start position is beyond the length of the substitution text. The system assigns a length of zero. Null
&YR8(3:3) The length exceeds the length of the substitution text beyond the specified start position. The system assigns the substring from the start position to the end of the substitution text. 08
&YR8(-2:a) The “a” character is not valid substring notation. The system treats the substring notation as normal text. 2008(-2:a)
&YR8.(3:3) The optional period indicates the end of the string. The system does not apply the substring notation to the string. The system treats the substring notation as normal text. 2008(3:3)