z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Combining string and positional patterns: a special case

z/OS TSO/E REXX Reference
SA32-0972-00

There is a special case in which absolute and relative positional patterns do not work identically. We have shown how parsing with a template containing a string pattern skips over the data in the source string that matches the pattern (see Templates containing string patterns). But a template containing the sequence:
  • string pattern
  • variable name
  • relative positional pattern
does not skip over the matching data. A relative positional pattern moves relative to the first character matching a string pattern. As a result, assignment includes the data in the source string that matches the string pattern.
/* Template containing string pattern, then variable name, then  */
/*  relative positional pattern does not skip over any data.     */
string='REstructured eXtended eXecutor'
parse var string var1 3 junk 'X' var2 +1 junk 'X' var3 +1 junk
say var1||var2||var3 /* Concatenates variables; displays: "REXX" */

Here is how this template works:

ikja3pa4

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014