View previous topic :: View next topic
|
Author |
Message |
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
Code: |
SYM = 'HLQ='LS.',SYS='F',JOB=LSFF0RIT' |
I have a variable which is
Now I need to get the value of SYS which is 'F' from SYM.
The Var1 can be 'HLQ' or 'JOB'.
Is there a way to PARSE to get the value acording to the 'Var1'. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
yes |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
here is a snippet
Code: |
kwd = var1 || "=" /* build the search string */
tmp = sym || "," /* append a comma for laziness"
p = pos( kwd, tmp )
if p > 0 then do
s = p + length(kwd) /* start of data after keyword */
e = pos(",", tmp, s) /* comma after value */
l = e - s
val = substr(tmp,s,l)
end
else ,
val = ""
|
|
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
How about this? (pay attention to the quotes and dots):
Code: |
PARSE VAR your_record . Var1 "'" VARVALUE "'" .
SAY VARVALUE |
O. |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
Thanks Enrico It works .... Thank you very much... |
|
Back to top |
|
|
|