I want to split this into two variables based on comma as separator. The values of two variables need to be
Var1 = 'a'
Var2 = 'b,c,d,e'
Again i have to take var2 and split based on comma into 'b' and 'c,d,e' and similarly it goes on.
I used UNSTRING to try this
UNSTRING Str1
DELIMITED BY ','
INTO VAR1, VAR2
END-UNSTRING
But the values i got are
Var1 = 'a'
Var2 = 'b'
I need value of var2 as 'b,c,d,e'
Can we prevent Unstring option from delimiting the receiving field?
I want to Delimit based in First occerenc alone
Is there any Option for this. Please advise
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
Again i have to take var2 and split based on comma into 'b' and 'c,d,e' and similarly it goes on.
Do you really need this or is the requirement to get 5 vars with the values a thru e (var1 = a, var2 = b, etc.)? What use is a variable with 'c,d,e' (other than to further break it down)?
A single unstring delimited by ',' naming 5 vars would break the entire field - which sounds like what your are coding to reach.