%SUBST Used for its Value
%SUBST Used for its Value
%SUBST returns a substring from the contents of the specified string. The string may be any character, graphic, or UCS-2 field or expression. Unindexed arrays are allowed for string, start, and length. The substring begins at the specified starting position in the string and continues for the length specified. If length is not specified then the substring continues to the end of the string. For example:
The value of %subst('Hello World': 5+2) is 'World'
The value of %subst('Hello World':5+2:10-7) is 'Wor'
The value of %subst('abcd' + 'efgh':4:3) is 'def'
When the starting positing is always 1, the %LEFT built-in function can be used.
For information about the CHARCOUNT mode affects %SUBST, see %SUBST with CHARCOUNT NATURAL.
Figure 1 shows an example of the %SUBST built-in function used for its value.