Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

PARSE to get the value acording to the 'Var1'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
vasan_4u

New User


Joined: 28 Jun 2005
Posts: 35
Location: chennai

PostPosted: Fri Feb 01, 2008 3:46 am    Post subject: PARSE to get the value acording to the 'Var1'
Reply with quote

Code:
SYM = 'HLQ='LS.',SYS='F',JOB=LSFF0RIT'

I have a variable which is
Code:
Var1 = 'SYS'


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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Fri Feb 01, 2008 4:23 am    Post subject: Reply to: How to PARSE ...
Reply with quote

yes
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Fri Feb 01, 2008 4:40 am    Post subject: Reply to: How to PARSE ...
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Feb 01, 2008 1:08 pm    Post subject:
Reply with quote

How about this? (pay attention to the quotes and dots):
Code:
PARSE VAR your_record . Var1 "'" VARVALUE "'" .
SAY VARVALUE


O.
Back to top
View user's profile Send private message
vasan_4u

New User


Joined: 28 Jun 2005
Posts: 35
Location: chennai

PostPosted: Fri Feb 01, 2008 10:51 pm    Post subject:
Reply with quote

Thanks Enrico It works .... Thank you very much...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to get the right string from Vari... jackzhang75 CLIST & REXX 9 Mon Nov 16, 2015 10:04 pm
No new posts Problem using PARSE Roach_MF DFSORT/ICETOOL 3 Tue Mar 17, 2015 11:44 pm
No new posts using Parse on some other operator fo... guptae DFSORT/ICETOOL 6 Thu Dec 11, 2014 11:11 am
No new posts PARSE question re: ABSPOS David Sde DFSORT/ICETOOL 2 Sun Jul 27, 2014 10:09 am
No new posts Keep/discard unmodified records based... David Sde DFSORT/ICETOOL 4 Thu Apr 17, 2014 10:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us