On Fri, 18 Jun 2021 11:30:21 -0400, Bob Bridges <[email protected]> wrote:
<snip> >I agree that CLIST handles this better, and every so often I think about a >REXX subroutine that imitates it. Then any of my REXXes could call the >subroutine, and the subroutine could parse the arguments and return them on >the stack. I've gotten as far writing something that handles embedded >quotes and comments, but haven't expanded it to parens yet. > >--- >Bob Bridges, [email protected], cell 336 382-7313 try this:- parmlist = Strip_Keyword_and_Option(parmlist) /*===================================================================*/ Strip_Keyword_and_Option: Procedure Expose keyword option Parse Arg string Parse Var string keyword temp "(" +0 string option = "" If (temp <> "" | string = "") Then Do string = temp || string End Else Do option = Substr(string, 2, Find_the_Match(1) -2, ")") string = Substr(string, length(option) +3) option = Strip(option) End If Left(keyword,1) = "," Then keyword = Substr(keyword,2) Parse Var keyword keyword "=" temp If Strip(temp) <> "" Then Do If Pos(",",temp) > 0 Then Do Parse Var temp temp "," trail string = trail || "(" || option || ")" || string End option = temp End If Pos(",",keyword) > 0 Then Do Parse Var keyword keyword "," temp string = temp || "(" || option || ")" || string Parse Var keyword keyword "=" option End Return string Find_the_Match: Procedure Expose string Do i= Arg(1) +1 to Length(string) If (Substr(string, i, 1) = "(") Then Do i = Find_the_Match(i) End Else Do If (Substr(string, i, 1) = ")") Then Do Return i End End End Return i /*===================================================================*/ Picked this code up sometime past. Regards Bruce ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
