Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10308
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: 10308
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts XML Parse for large file muralikrishnan_new COBOL Programming 3 Mon Jun 12, 2017 12:50 pm
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

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us