A recent note asked how, in REXX, to parse a record in this format:

"word1 word2.word3 word4:word5.word6 word7 hh.mm.ss"

into these variables.

var1 = "word1"
var2 = "word2.word3"
var3 = "word4:word5.word6"
var4 = "word7"
var5 = "hh"
var6 = "mm"
var7 = "ss"

  A friend, Harry Elder ([email protected]), offers this solution:
 
input = "word1 word2.word3 word4:word5.word6 word7 hh mm ss"; 
 
do v = 1 to 7;
 var.v = word(input,v);
end; 

do v = 1 to 7;
 say v || ")" var.v; 
end; 

/* results: 

1) word1
2) word2.word3
3) word4:word5.word6
4) word7
5) hh
6) mm
7) ss
 
*/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to