From: Jeff H. <Je...@Je...> - 2023-04-19 18:21:44
|
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <p>I have just released an extension to the NetRexx Pipelines <b>PARSE</b> stage, together with tests and documentation. It should be in the next release.</p> <p>Note: This changes the variable names from "$1" through "$9" to "_1" to "_9" to avoid a NetRexx internal name conflict. $-variables are depreciated, but will, for now, work in existing pipes<br> </p> <p>It extends the current <b>parse</b> stage from just input and output templates to include a optional <b>netrexx</b> (or <b>nr</b>) delimited string of one or more NetRexx statements between the two templates. Also a <b>finally</b> delimited string of statements. This greatly increases the power of this stage. <b>Parse</b> stage is only NetRexx Pipelines, not CMS.<br> </p> <blockquote> /** parse -- Rearrange Contents of Records using Rexx Parse<br> <br> <font face="Cascadia Code">>>--PARSE--parse_template_Dstring--></font><br> <font face="Cascadia Code"> </font><br> <font face="Cascadia Code"> >--+-----------------------------+--></font><br> <font face="Cascadia Code"> +-+-NETREXX-+-NetRexx_Dstring-+</font><br> <font face="Cascadia Code"> +-NR------+</font><br> <font face="Cascadia Code"> </font><br> <font face="Cascadia Code"> >--+-------------------------+--></font><br> <font face="Cascadia Code"> +-output_template_Dstring-+</font><br> <font face="Cascadia Code"> </font><br> <font face="Cascadia Code"> >--+---------------------------------+--><</font><br> <font face="Cascadia Code"> +-FINALLY-finally_NetRexx_Dstring-+</font><br> <br> Records are parsed via the parse_template_delimited_string.<br> Variables are named _n, where n is 1 to 9.<br> The values of the variables are put into the output_template_delimited_string<br> replacing _n.<br> For a literal _n that won't be changed, use __n.<br> The NetRexx_Dstring and finally_NetRexx_Dstring are any valid NetRexx statement<br> or ;-separated statements that may use and set the ""_n"" variables.<br> The string \n will split the string into separate output records.<br> The special indexed variable COUNTER[] is also available in these Dstrings.<br> Note: Now depreciated: "$n" instead of "_n"; no NR or FINALLY.<br> <br> Examples:<br> parse / 2 _1 +1/ /The second letter is \"_1\". __1 won't be changed./<br> <br> parse / _1 2 _2 +1 _3/ NR /_2 = _2.upper/ /_1_2_3/<br> <br> PARSE /_1 2 _2 +1 _3/ ,<br> NR /if _2.datatype('l') then counter['c'] = counter['c'] + 1; _2 = _2.upper/ ,<br> /_1_2_3/ ,<br> FINALLY /return counter['c'] 'changed to upper'/<br> <br> parse /2 _1 +1/ NR /counter[1]=counter[1]+1/ FINALLY /_9="Count:" counter[1]/ /_9/<br> <br> */ </blockquote> <p></p> </body> </html> |