Steve has it right. Literals take precedent. So it works like this:
Step 1) split as Temp1 '.' Temp2 '.' Temp3
so: Temp1 = word1 word2
Temp2 = word3 word4:word5
Temp3 = word6 word7 hh.mm.ss
Step 2) split the "temps" based on the parsing between literals:
so: Parse Temp1 with var1 var2 var3 var4 var5
giving: var1 = word1
var2 = word2
var3-var5 = nulls because no more words in Temp1
so: Parse Temp2 with war6
giving var6 = word3 word4:word5 (because only one parse into field)
so: Parse Temp3 with var7
giving var7 = word6 word7 hh.mm.ss (because only one parse into field)
Tony Thigpen
Steve Horein wrote on 02/24/2017 06:05 AM:
Looks to me your literal delimiter took precedent over space delimiters.
In other words, PARSE looked for "." first, and found "word3 word4:word5"
between the specified literals.
On Fri, Feb 24, 2017 at 3:32 AM, Peter Hunkeler <[email protected]> wrote:
This is some Friday fun with parsing with REXX. First I was baffled with
the result, now I understand. So *no* I will not join the TSO/REXX list ;-)
I've got a data set to process with REXX. The records are of format:
"word1 word2.word3 word4:word5.word6 word7 hh.mm.ss"
What I need is each record split into:
var1 = "word1"
var2 = "word2.word3"
var3 = "word4:word5.word6"
var4 = "word7"
var5 = "hh"
var6 = "mm"
var7 = "ss"
Easy, I thought and coded:
PARSE VAR input var1 var2 var3 var4 var5 "." var6 "." var7 .
The result baffled me and was far from anything I understood at first.
Here is what the variables look like:
var1 ==> "word1"
var2 ==> "word2"
var3 ==> ""
var4 ==> ""
var5 ==> ""
var6 ==> "word3 word4:word5"
var7 ==> "word6"
Have fun.
--
Peter Hunkeler
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN