I use this code:- /*===================================================================*/ 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 /*===================================================================*/
On Mon, 1 May 2023 23:30:51 +0000, Frank Swarbrick <frank.swarbr...@outlook.com> wrote: >The following is a simplified version of some code from IBM's CEEBLDTX, placed >in to an EXEC I've named PARENS: > >Parse Arg option >Parse Var option varOpt '(' valueOpt ')' >Say varOpt >Say valueOpt > >This handles a simple dataset name, e.g.: > >Test1: PARENS COBOL(TEST): >Results1: >COBOL >TEST > >But it doesn't work for a PDS member to following, also surrounded by >parentheses: > >Test2: PARENS COBOL(TEST(MEMBER)) >Results2: >COBOL >TEST(MEMBER > >Any simple REXX parse option to handle this, or do I need to resort to more >complex REXX? Or do I just add a trailing paren if there is a leading one in >valueOpt? Perhaps that's the simples answer. > >Frank > > Regards Bruce ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN