IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PARSE to get the value acording to the 'Var1'


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2008 4:23 am
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 01, 2008 4:40 am
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: 2358
Location: Israel

PostPosted: Fri Feb 01, 2008 1:08 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts INREC PARSE used to sort a CSV file DFSORT/ICETOOL 2
No new posts JSON transform using CICS bundles vs.... CICS 3
No new posts JSON PARSE in Enterprise COBOL COBOL Programming 2
No new posts PARSE using REPEAT DFSORT/ICETOOL 1
Search our Forums:

Back to Top