I'm probably going to explain this incorrectly, but the jist of the problem is 
the literal periods in the PARSE statement.

Due to the literal periods ("."), PARSE assigns the values of "word1" and 
"word2" to var1 and var2 respectively.
Then, PARSE assigns nulls to var3, var4 and var5 bringing the parse pattern and 
variable's value into sync with the first literal period (".") and PARSE then 
assigns "word3 word4:word5" to var6.
Finally, var7 is assigned "word6" and the trailing period is "assigned" the 
remainder, "word7 hh.mm.ss".

Is this what you concluded?


Charles (Chuck) Hardee
Senior Systems Engineer/Database Administration
EAS Information Technology

Thermo Fisher Scientific
300 Industry Drive | Pittsburgh, PA 15275
Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230
[email protected]  | www.thermofisher.com

WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this 
e-mail or the information herein by anyone other than the intended recipient, 
or an employee or agent of a system responsible for delivering the message to 
the intended recipient, is prohibited. If you are not the intended recipient, 
please inform the sender and delete all copies.

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Peter Hunkeler
Sent: Friday, February 24, 2017 4:33 AM
To: [email protected]
Subject: Friday fun with REXX and PARSE

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

Reply via email to