Syntax:
PARSE term template
The term is evaluated and converted (if necessary) to a Rexx string. It is then parsed according to the template and following Rexx rules, as defined in the ANSI Standard for Rexx. Any values that are used in patterns during the parse are converted to type Rexx; the results of parsing are type Rexx.
Any variables used by PARSE must be a simple name (not an array reference or other term), and refer to a variable or property in the current class.
Here are some examples of PARSE:
foo='now is my time' parse foo a b c /* (a=='now' & b=='is' & c==' my time') */ parse foo a . . c /* (a=='now' & c=='time') */ parse foo a 'my' c /* (a=='now is ' & c==' time') */ parse foo 3 a -1 b +3 c +3 /* (a=='w is my time' & b=='ow ' & c=='is ') */
Please see Rexx documentation for full details of parse templates.
By convention (automatically if the 'main' method is generated by the NetRexx processor), the 'main' method in a stand-alone NetRexx application should place the command string passed to it in the Rexx string variable called 'arg'. Hence the instruction:
parse arg template
will work, in a stand-alone application, in the same way as in Rexx (even though ARG is not a keyword in this case). Note that the command string may have been edited by the environment; certain characters may not be allowed, multiple blanks may have been reduced to single blanks, etc.
Similarly, the special words 'ask', 'source', and 'version' allow
parse ask x -- like Rexx parse pull parse source x -- uses 'Java method' followed by filename parse version x -- uses 'NetRexx' followed by version and date
These three words may also be used within expressions.
[ previous section | contents | next section ]
From 'netrexx.doc', version 0.75.
Copyright(c) IBM Corporation, 1996. All rights reserved. ©