pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Hi all
I will receive user input like
Offset='1:20,30:10,40:15,60:70'
I tried the below piece of code
Code: |
/*****REXX****/
say 'Enter the offset and length value like:(1:20,30:15,40:15)'
Pull offst
offset1=strip(offst)
cnt1=find(offset1,',')
if cnt1=0 then
do
parse value offset1 with o1 ':' l1
end
if cnt1=1 then
do
pos1=pos(',',offset1)
pos2=pos1-1
str1=substr(offset1,1,pos2)
str2=substr(offset1,pos1 +1)
parse value str1 with o1 ':' l1
parse value str2 with o2 ':' l2
end
.
.
.
|
I will try trace option to fix the code , but is there any alternate function to
extract the value? Please share. I need to get 1:20 as o1=1 and l1=20 Dynamically from user input. |
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Code: |
/* Rexx */
data = "01:20,30:15,40:15"
do while data \= ""
parse var data tokn "," data
parse var tokn head ":" tail
say tokn head tail
end
|
|
|