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"
>
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.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN