> but I don't expect anybody on this forum to bother downloading it 
> because writing logic is preferable to learning something new ;)

 1. This is a listserv mailing list, not a forum
 2. I am far from the only reader of this list to enjoy new things,
     and in particular I am far from being the only one to value
     the expressive power of regexen.
 3. Don't confuse lack of familiarity with prejudice against;
     why not give some examples and see whether anybody is interested? 


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of 
David Crayford [dcrayf...@gmail.com]
Sent: Thursday, February 27, 2020 9:30 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Rexx parse using period as placeholder

I consider simple to be a single line regular expression which can
handle the parsing grammar in one hit. Now, that may not to simple to
most mainframe old timers
but it's a walk in the park for young guys.

Like I said I have a RE package on github that can do this stuff in REXX
but I don't expect anybody on this forum to bother
downloading it because writing logic is preferable to learning something
new ;)

On 2020-02-27 9:58 PM, scott Ford wrote:
> Hey David,
>
> What do you mean by simple ? Less stmts ?
>
> On Thu, Feb 27, 2020 at 8:50 AM Seymour J Metz <sme...@gmu.edu> wrote:
>
>> As an alternative to regexen, there is a package called PROC that does the
>> subset of IKJPARSE needed for CLIST style parameters. There may be other
>> such tools out there; if I knew of a decent search engine ...
>>
>>
>> --
>> Shmuel (Seymour J.) Metz
>> http://mason.gmu.edu/~smetz3
>>
>> ________________________________________
>> From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf
>> of David Crayford [dcrayf...@gmail.com]
>> Sent: Thursday, February 27, 2020 6:07 AM
>> To: IBM-MAIN@LISTSERV.UA.EDU
>> Subject: Re: Rexx parse using period as placeholder
>>
>> OK. Let me change the requirements again ;) How about also handling
>> single quotes for a fully qualified data set.
>>
>> Simple to do with a regex. Not so simple using REXX.
>>
>> Syntax:
>>
>>        INDSN(DSNAME(MEMBER))
>>        INDSN(DSNAME)
>>        INDSN('HLQ.DSNAME(MEMBER)')
>>        INDSN('HLQ.DSNAME')
>>
>>
>> On 2020-02-27 12:28 AM, Seymour J Metz wrote:
>>>> Great! How will that work if I don't have a member name?
>>> The code will tell me not to believe you when you write
>>>
>>> "Syntax:
>>>
>>>        INDSN(DSNAM(MEMBER))"
>>>
>>> Writing the code is the easy part; the hard part is getting the actual
>> requirements.
>>>
>>> --
>>> Shmuel (Seymour J.) Metz
>>> http://mason.gmu.edu/~smetz3
>>>
>>> ________________________________________
>>> From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on
>> behalf of David Crayford [dcrayf...@gmail.com]
>>> Sent: Wednesday, February 26, 2020 7:18 AM
>>> To: IBM-MAIN@LISTSERV.UA.EDU
>>> Subject: Re: Rexx parse using period as placeholder
>>>
>>> Great! How will that work if I don't have a member name?
>>>
>>> INDSN(DSNAME)
>>>
>>>
>>> On 2020-02-26 8:11 PM, Seymour J Metz wrote:
>>>> When I'm testing a template I usually use variable names so it's easier
>> to follow what's happening; feel free to change them to periods.
>>>> trace i;parse var parm  kw '(' dsn '(' mem ')' ')'
>>>>        95 *-*           parse var parm  kw '(' dsn '(' mem ')' ')'
>>>>           >V>             "INDSN(DSNAME(MEMBER))"
>>>>           >L>             "("
>>>>           >>>             "("
>>>>           >>>             "INDSN"
>>>>           >L>             "("
>>>>           >>>             "("
>>>>           >>>             "DSNAME"
>>>>           >L>             ")"
>>>>           >>>             ")"
>>>>           >>>             "MEMBER"
>>>>           >L>             ")"
>>>>           >>>             ")"
>>>>        96 *-*           trace 'Off'                    /* Don't trace
>> rexxtry.
>>>>     */
>>>>      ................................................ REXXTRY.CMD on OS/2
>>>> say dsn mem
>>>> DSNAME MEMBER
>>>>
>>>>
>>>>
>>>> --
>>>> Shmuel (Seymour J.) Metz
>>>> http://mason.gmu.edu/~smetz3
>>>>
>>>> ________________________________________
>>>> From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on
>> behalf of David Crayford [dcrayf...@gmail.com]
>>>> Sent: Wednesday, February 26, 2020 7:01 AM
>>>> To: IBM-MAIN@LISTSERV.UA.EDU
>>>> Subject: Re: Rexx parse using period as placeholder
>>>>
>>>> I've got a REXX parse puzzle to solve and I would like suggestions on
>>>> how to solve it.
>>>>
>>>> Syntax:
>>>>
>>>>         INDSN(DSNAM(MEMBER))
>>>>
>>>>         The code is simple. It uses the parse instruction with a
>> template.
>>>>            parse var parm . '(' val ')'
>>>>
>>>>
>>>>           *-* parm = 'INDSN(DSNAME(MEMBER))'
>>>>           >L>   "INDSN(DSNAME(MEMBER))"
>>>>           *-* parse var parm . '(' val ')'
>>>>           >.>   "INDSN"
>>>>           >>>   "DSNAME(MEMBER"
>>>>
>>>> Unfortunately the value is truncated because "parse" has no way to
>>>> anchor to the end of the string.
>>>>
>>>> Using a regex this is very simple "\((.*)\)$"
>>>>
>>>> Most modern languages have PEG libraries (parsing expression grammers)
>>>> which are much more powerful that regex. They can be called recursively
>>>> and used to implement real parsers.
>>>>
>>>> Even a simple scripting like Lua (which runs on z/OS) has a library
>>>> which can be used to implement a C99 parser in 500 lines of code
>>>>
>> https://secure-web.cisco.com/1-qpVukWY5CQ__uk-jb69c-vU9oQiHr0QYGSPlCeoZgyD2_0Vr7rZvCFOZMHJg7zk3VOksBvTUY8MLW1evN4UV9cNBh-pn9n-5F9_X82JabsK-ab5tZgKrsgKaJaEaxaxX5DQT-npVqFY2v_bsph_x8TPP0FtlXCodigNSekdfPE7jkgJNBmS59AWuMpG8X-Uk87HGTSjWom-rjWZ2cck7YmxwA8YD0v-eN-AL17ABCPz1J03MFZeG5DTXPPIQZDHjFYyC1zarF945-8oyYAd868yq1R6J7tuZO3LwSG-nXLyxFjuFhxAFLZjb5wzxr9ud0_gAOZpFtSdNUpsdux1AoWvZREOg5L4JMcfEVubG-1nO2eSTtdsuvL3IPGSGD4-HEKFuhCLSVZQb4nT1RtVUgxxwK-lTjuUgN8iE103myJE9v-kJevMwsdsZ3jGRYmT/https%3A%2F%2Fgithub.com%2Ftitan-lang%2Fc-parser%2Fblob%2Fmaster%2Fc99.lua
>> .
>>>>
>>>> On 2020-02-26 11:41 AM, Paul Gilmartin wrote:
>>>>> On 2020-02-24, at 13:43:52, Ambros, Thomas wrote:
>>>>>> A trivial item, but this surprised me.
>>>>>>
>>>>>> I wanted to parse out the string 'word3' using the period as a place
>> holder.  The input could have a blank delimited string containing an
>> embedded period before the one I wanted to parse out.  The Parse Var as
>> coded didn't work.  ...
>>>>>> myVar = 'word1 word2 9.12 word3.ext'
>>>>>> Parse Var myVar . . . myVal '.' .
>>>>>>         ...
>>>>>> Say 'myVal=' myVal
>>>>>>         ...
>>>>> The simple answer to the elliptically stated problem is:
>>>>>         MyVal = 'word3'
>>>>>
>>>>> A more general solution, using regex is:
>>>>> 556 $ echo 'word1 word2 9.12 word3.ext' | sed 's/.* \([^.]*\).*/\1/'
>>>>> word3
>>>>> 557 $
>>>>> This finds the last substring in the subject preceded by a space
>>>>> and followed by a period.
>>>>>
>>>>> Full disclosure, for Tony to gloat:
>>>>> o It's easier to code than to review.
>>>>> o I got it right on the third try.
>>>>> o I haven't fuzz tested.
>>>>>
>>>>> -- gil
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>>> ----------------------------------------------------------------------
>>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>>>
>>>> ----------------------------------------------------------------------
>>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>> ----------------------------------------------------------------------
>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>>
>>> ----------------------------------------------------------------------
>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to