| Function: | CALL PRXCHANGE |
|---|
| Purpose: | To substitute one string for another. One advantage of using PRXCHANGE over TRANWRD is that you can search for strings using wild cards. Note that you need to use the substitution (s) operator in the regular expression to specify the search and replacement expression (see the explanation following the program). |
| Syntax: | CALL PRXCHANGE (pattern-id or regular-expression, times, old-string <, new-string <, result-length <,truncation-value <, number-of-changes>>>>); |
| | pattern-id is the value returned from the PRXPARSE function. |
| | regular-expression is a Perl regular expression, placed in quotation marks. |
| | times is the number of times to search for and replace a string. A value of -1 will replace all matching patterns. |
| | old-string is the string that you want to replace. If you do not specify new-string, the replacement will take place in old-string. |
| | new-string, if specified, names the variable to hold the text after replacement. If new-string is not specified, the changes are made to old-string. |
| | result-length is the name of the variable that, if specified, is assigned a value representing the length of the string after replacement. Note that trailing blanks in old-string are not copied to new-string. |
| | truncation-value is the name of the variable that, if specified, is assigned a value of 0 or 1. If the resulting string is longer than the length of new-string, the value is 1; otherwise it is a 0. This value is useful to test if your string was truncated because the replacements resulted in a length longer than the original specified length. |
| | number-of-changes is the name of the variable that, if specified, is assigned a value representing the total number of replacements that were made. |