I'm confused by this whole thread.  I'm surprised at the behavior of the
program, I'm baffled why Shmuel would ask why Thomas is surprised, and I
don't understand what Thomas means by saying "it is the definition of a
blank delimited word" that escaped him.

The obvious behavior of the parse statement - obvious to me - is this:

  *-* Parse Value myVar with . . . myVal2 '.' .
  >>>   "word1 word2 9.12 word3.ext"
  >.>   "word1"
  >.>   "word2"
  >.>   "9.12"
  >>>   "word3"
  >.>   "ext"

Surely this is what Thomas expected.  I can't imagine what would
legitimately cause REXX to behave in any other way - and I don't understand
why anyone would expect anything different.  Now I'm going to go read that
link someone posted that's supposed to explain it.  But I don't get it.

---

Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313

/* ...the director and the writers keep changing the script.  The actors
will do a scene, and the director will say, "OK, that was perfect, but this
time, Bob, instead of saying 'What's for dinner?' you say, 'Wait a minute!
Benzene is actually a hydrocarbon!'  And say it with a Norwegian accent.
Also, we think maybe your character should have no arms."  -Dave Barry,
describing his acting debut in "Dave's World" */

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Ambros, Thomas
Sent: Monday, February 24, 2020 16:27

You mean like this?

*-* Parse Value myVar with . . . myVal2 '.' .
>>>   "word1 word2 9.12 word3.ext"
>.>   "word1"
>.>   "word2"
>.>   "9"
>>>   ""
>.>   "12 word3.ext"

But you're correct, variables result in the same behavior:

*-* Parse Value myVar with t1 t2 t3 myVal2 '.' .
>>>   "word1 word2 9.12 word3.ext"
>>>   "word1"
>>>   "word2"
>>>   "9"
>>>   ""
>.>   "12 word3.ext"

So it is the definition of a blank delimited word that escaped me.  I'll
look for a precise definition of one of those in the context of Rexx. 

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of
Seymour J Metz
Sent: Monday, February 24, 2020 16:17

Why did it surprise you, and what does it have to do with the placeholders?
You'd get the same thing if you used three variable names instead of three
periods. The parse with works because it's using a different template on a
different value: try

    parse Value myVar with . . . myVal '.' .

________________________________________
From: Ambros, Thomas [0000010f77c934b1-dmarc-requ...@listserv.ua.edu]
Sent: Monday, February 24, 2020 3:43 PM

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.
Using the Parse Value as coded there does work.  I didn't know it would
behave like that.  I can't seem to find this documented but I might have
overlooked something.

myVar = 'word1 word2 9.12 word3.ext'
Parse Var myVar . . . myVal '.' .
Parse Value Subword(myVar,4) with myVal2 '.' .
Say 'myVal=' myVal
Say 'myVal2=' myVal2
Exit

Trace R of that code:

     3 *-* myVar = 'word1 word2 9.12 word3.ext'
       >>>   "word1 word2 9.12 word3.ext"
     4 *-* Parse Var myVar . . . myVal '.' .
       >.>   "word1"              -
       >.>   "word2"
       >.>   "9"
       >>>   ""
       >.>   "12 word3.ext"
     5 *-* Parse Value Subword(myVar,4) with myVal2 '.' .
       >>>   "word3.ext"
       >>>   "word3"
       >.>   "ext"
     6 *-* Say 'myVal=' myVal
       >>>   "myVal= "
myVal=
     7 *-* Say 'myVal2=' myVal2
       >>>   "myVal2= word3"
myVal2= word3
     8 *-* Exit

----------------------------------------------------------------------
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