I didn't pay much attention to this subthread, back when it first started
up.  But it looks as though it's lasting longer than I expected; maybe I
should go back and reread and figure out what's holding up the solution.
You're trying to work out a way to pass and correctly parse an argument that
may (or may not) have quotes and parens?  Since it's a DSN, there'll be no
embedded spaces, right?  So it doesn't sound like it should be that hard.

Clearly I'm missing something; if it's still being discussed here, it ~is~
that hard.  But I once wrote, and still occasionally use, an external REXX
that parses arguments with multiple levels of quotes and comments, without
being confused by embedded spaces.  Would the principles used there be any
help here?

Like this:

  ==> tso cmd arg1 'two-word arg' /* comment "ignored" */ "multi-word arg
'with ""embedded"" quotes'" arg4

The exec passes the entire arg string to PARSEARG, which reads the string
and returns on the stack:

  arg1
  two-word arg
  multi-word arg 'with "embedded" quotes'
  arg4

PARSEARG certainly requires more than just one PARSE statement to work
properly, and I never thought to take parens into account.  But the general
principles it requires might apply to your problem too.

---
Bob Bridges, [email protected], cell 336 382-7313

/* I hold it, that a little rebellion now and then is a good thing, and as
necessary in the political world as storms in the physical.  -Thomas
Jefferson */


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Seymour J Metz
Sent: Friday, February 28, 2020 10:21

The nested parentheses are more of a problem than the apostrophes. I would
either do it with a CLIST or track down the PROC package; I doubt that
there's a clean way to do it in straight classic REXX, and evev the regular
expression package of ooRexx laxks some standard refex features that would
help..

________________________________________
From: IBM Mainframe Discussion List [[email protected]] on behalf of
David Crayford [[email protected]]
Sent: Friday, February 28, 2020 6:48 AM

How to do this maintaining the quotes? That's needed for allocating the
data set.

Yet again, simple to do with a regex.

--- On 2020-02-28 1:41 AM, Dale R. Smith wrote:
> Try this:
> Parse Value Space(Translate(parm,"","'"),0)' ' With . '(' val ') ' .
>
> (Forgot that Translate does not support translating to nulls.)

> --- On Thu, 27 Feb 2020 17:30:03 +0000, Seymour J Metz <[email protected]>
wrote:
>> The quotes were OK, the space between translate and the left paren was
not. Fixing that
>>
>>     parm="INDSN('HLQ.DSNAME(MEMBER)')"
>>     Parse Value Translate(parm,"","'")' ' With fill1 '(' val ') '
fill2;say 'fill1='fill1 'val='val 'fill2='fill2
>>
>> gives me
>>
>>     fill1=INDSN val= HLQ.DSNAME(MEMBER fill2=)
>>
>> Not only did it lose the RP, it also stripped off the apostrophes
indicating that it was a FQDSN.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to