Ah, I withdraw my confusion; IBM needed to emphasize the word "first" more than 
they did, perhaps, but Gil's explanation finally got through to me.  It's 
something I may be able to keep in mind in the future.  Or maybe not.  But:

  myVar = 'word1 word2 9.12 word3.ext'
  Parse Var myVar . . . myVal '.' .  

First it divides the string by the literal '.':

  1) 'word1 word2 9'
  2) '12 word3.ext'

The first part gets divided by the parse string ". . . myVal", which results in 
"word1", "word2", '9' and ''.  The second part is parsed by '.', which is "12 
word3.ext".  Weird, but at least the universe makes sense again.

The trick, I guess, is to remember to class parsing operations according to 
precedence, just as we do with arithmetic and Boolean operators.

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

/* Good teaching is one-fourth preparation and three-fourths good theatre.  
-Gail Godwin */


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

Here's where it tries to describe it:
    
https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.ikja300/parspat.htm

    ... First, the language processor scans the source string for 
'[literal-string-pattern]' ...

Examples are nice, but they don't completely imply rules.  It's woefully 
inadequate.
The rules should be stated in such a way that the behavior can be inferred 
without
reference to examples.

The importance of "First" can't be emphasized too much.

The effect of multiple string patterns should be clarified.

--- On Mon, 24 Feb 2020 20:43:52 +0000, 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.  
>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 '.' .  
>    ...
>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"

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