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
 

 

Single quote delimiter in parsing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    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

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, 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: 4648
Location: Raleigh, 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
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 Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Single step utility for compare and u... ramprakashn JCL & VSAM 5 Fri Apr 29, 2016 3:43 pm
No new posts Parsing and Listing a Subset of Recor... Charles Wolters IBM Tools 3 Fri Feb 05, 2016 10:39 pm


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