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

Single quote delimiter in parsing


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohitsir

New User


Joined: 21 Aug 2007
Posts: 32
Location: USA

PostPosted: Fri Mar 14, 2008 4:00 am
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
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Mar 14, 2008 5:08 am
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
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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Mar 14, 2008 11:29 pm
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
Reply with quote

My bad. It does work.
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 How to append a PS file into multiple... JCL & VSAM 3
No new posts Parsing Large JSON file using COBOL COBOL Programming 4
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top