Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Single quote delimiter in parsing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
rohitsir

New User


Joined: 21 Aug 2007
Posts: 32
Location: USA

PostPosted: Fri Mar 14, 2008 4:00 am    Post subject: Single quote delimiter in parsing
Reply with quote

I have a string:
DEFINE SBR NAME='SC#HOG',

I want to parse the string data such that I get SC#HOG in a separate field without quotes. Can I do this just using single PARSE VAR instruction ???
Back to top
View user's profile Send private message
References
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3316
Location: Charlotte,NC USA

PostPosted: Fri Mar 14, 2008 5:08 am    Post subject: Reply to: single quote delimiter in parsing
Reply with quote

Does this work for you?

string = "DEFINE SBR NAME='SC#HOG',"
...
Parse Var string . "'" varname "'" .

or

Parse Var string . '=' varname ',' .
varname = Strip(varname,B,"'")
Back to top
View user's profile Send private message
rohitsir

New User


Joined: 21 Aug 2007
Posts: 32
Location: USA

PostPosted: Fri Mar 14, 2008 10:52 pm    Post subject:
Reply with quote

The first approach doesn't work. I have already tried it. The second approach does work. I have done sth different to achieve it.

LEN = LENGTH(VARNAME)
VARNAME = LEFT(VARNAME,LEN - 1)
VARNAME = RIGHT(VARNAME,LEN - 2)

Thanks for the reply.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3316
Location: Charlotte,NC USA

PostPosted: Fri Mar 14, 2008 11:29 pm    Post subject:
Reply with quote

rohitsir wrote:
The first approach doesn't work.


Yes it does.

Code:

     3 *-* string = "DEFINE SBR NAME='SC#HOG',"       
       >L>   "DEFINE SBR NAME='SC#HOG',"               
     4 *-* Parse Var string . "'" varname "'" .       
       >.>   "DEFINE SBR NAME="                       
       >>>   "SC#HOG"                                 
       >.>   ","                                       
     5 *-* Say varname                                 
       >V>   "SC#HOG"                                 
SC#HOG                                                 
     6 *-* Exit 0                                     
       >L>   "0"                                       
Back to top
View user's profile Send private message
rohitsir

New User


Joined: 21 Aug 2007
Posts: 32
Location: USA

PostPosted: Mon Mar 17, 2008 9:50 pm    Post subject:
Reply with quote

My bad. It does work.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1